blob: fa15b0de40f7516e6410a2ac225cdde52688821c [file] [log] [blame]
[email protected]d18720a2012-01-06 09:53:551// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]678c0362012-12-05 08:02:445#include "content/browser/loader/layered_resource_handler.h"
[email protected]d18720a2012-01-06 09:53:556
[email protected]62b4a962012-01-18 22:53:167#include "base/logging.h"
8
[email protected]d18720a2012-01-06 09:53:559namespace content {
10
[email protected]d651cbc2012-05-31 21:33:0511LayeredResourceHandler::LayeredResourceHandler(
[email protected]ef5306e2013-10-15 19:38:1812 net::URLRequest* request,
[email protected]d651cbc2012-05-31 21:33:0513 scoped_ptr<ResourceHandler> next_handler)
[email protected]ef5306e2013-10-15 19:38:1814 : ResourceHandler(request),
15 next_handler_(next_handler.Pass()) {
[email protected]d651cbc2012-05-31 21:33:0516}
17
18LayeredResourceHandler::~LayeredResourceHandler() {
[email protected]d18720a2012-01-06 09:53:5519}
20
[email protected]56f0b082012-06-14 07:12:3221void LayeredResourceHandler::SetController(ResourceController* controller) {
22 ResourceHandler::SetController(controller);
23
24 // Pass the controller down to the next handler. This method is intended to
25 // be overriden by subclasses of LayeredResourceHandler that need to insert a
26 // different ResourceController.
27
28 DCHECK(next_handler_.get());
29 next_handler_->SetController(controller);
30}
31
[email protected]d22e800e2014-05-28 21:55:5732bool LayeredResourceHandler::OnUploadProgress(uint64 position,
[email protected]d18720a2012-01-06 09:53:5533 uint64 size) {
[email protected]d651cbc2012-05-31 21:33:0534 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5735 return next_handler_->OnUploadProgress(position, size);
[email protected]d18720a2012-01-06 09:53:5536}
37
[email protected]cba24642014-08-15 20:49:5938bool LayeredResourceHandler::OnRequestRedirected(
39 const net::RedirectInfo& redirect_info,
40 ResourceResponse* response,
41 bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0542 DCHECK(next_handler_.get());
[email protected]cba24642014-08-15 20:49:5943 return next_handler_->OnRequestRedirected(redirect_info, response, defer);
[email protected]d18720a2012-01-06 09:53:5544}
45
[email protected]d22e800e2014-05-28 21:55:5746bool LayeredResourceHandler::OnResponseStarted(ResourceResponse* response,
[email protected]22b305442012-05-21 18:02:5947 bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0548 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5749 return next_handler_->OnResponseStarted(response, defer);
[email protected]d18720a2012-01-06 09:53:5550}
51
[email protected]d22e800e2014-05-28 21:55:5752bool LayeredResourceHandler::OnWillStart(const GURL& url,
[email protected]d18720a2012-01-06 09:53:5553 bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0554 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5755 return next_handler_->OnWillStart(url, defer);
[email protected]d18720a2012-01-06 09:53:5556}
57
[email protected]d22e800e2014-05-28 21:55:5758bool LayeredResourceHandler::OnBeforeNetworkStart(const GURL& url,
[email protected]5584eab2014-01-09 22:16:1559 bool* defer) {
60 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5761 return next_handler_->OnBeforeNetworkStart(url, defer);
[email protected]5584eab2014-01-09 22:16:1562}
63
[email protected]d22e800e2014-05-28 21:55:5764bool LayeredResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
[email protected]ef5306e2013-10-15 19:38:1865 int* buf_size,
66 int min_size) {
[email protected]d651cbc2012-05-31 21:33:0567 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5768 return next_handler_->OnWillRead(buf, buf_size, min_size);
[email protected]d18720a2012-01-06 09:53:5569}
70
[email protected]d22e800e2014-05-28 21:55:5771bool LayeredResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0572 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5773 return next_handler_->OnReadCompleted(bytes_read, defer);
[email protected]d18720a2012-01-06 09:53:5574}
75
[email protected]3780874a2013-11-18 05:49:0376void LayeredResourceHandler::OnResponseCompleted(
[email protected]d18720a2012-01-06 09:53:5577 const net::URLRequestStatus& status,
[email protected]3780874a2013-11-18 05:49:0378 const std::string& security_info,
79 bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0580 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5781 next_handler_->OnResponseCompleted(status, security_info, defer);
[email protected]d18720a2012-01-06 09:53:5582}
83
[email protected]d22e800e2014-05-28 21:55:5784void LayeredResourceHandler::OnDataDownloaded(int bytes_downloaded) {
[email protected]d651cbc2012-05-31 21:33:0585 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5786 next_handler_->OnDataDownloaded(bytes_downloaded);
[email protected]d18720a2012-01-06 09:53:5587}
88
[email protected]d18720a2012-01-06 09:53:5589} // namespace content