blob: 00048ae520afd486eabf9b4b9ea09be321aec408 [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]cba24642014-08-15 20:49:5932bool LayeredResourceHandler::OnRequestRedirected(
33 const net::RedirectInfo& redirect_info,
34 ResourceResponse* response,
35 bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0536 DCHECK(next_handler_.get());
[email protected]cba24642014-08-15 20:49:5937 return next_handler_->OnRequestRedirected(redirect_info, response, defer);
[email protected]d18720a2012-01-06 09:53:5538}
39
[email protected]d22e800e2014-05-28 21:55:5740bool LayeredResourceHandler::OnResponseStarted(ResourceResponse* response,
[email protected]22b305442012-05-21 18:02:5941 bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0542 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5743 return next_handler_->OnResponseStarted(response, defer);
[email protected]d18720a2012-01-06 09:53:5544}
45
[email protected]d22e800e2014-05-28 21:55:5746bool LayeredResourceHandler::OnWillStart(const GURL& url,
[email protected]d18720a2012-01-06 09:53:5547 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_->OnWillStart(url, defer);
[email protected]d18720a2012-01-06 09:53:5550}
51
[email protected]d22e800e2014-05-28 21:55:5752bool LayeredResourceHandler::OnBeforeNetworkStart(const GURL& url,
[email protected]5584eab2014-01-09 22:16:1553 bool* defer) {
54 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5755 return next_handler_->OnBeforeNetworkStart(url, defer);
[email protected]5584eab2014-01-09 22:16:1556}
57
[email protected]d22e800e2014-05-28 21:55:5758bool LayeredResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
[email protected]ef5306e2013-10-15 19:38:1859 int* buf_size,
60 int min_size) {
[email protected]d651cbc2012-05-31 21:33:0561 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5762 return next_handler_->OnWillRead(buf, buf_size, min_size);
[email protected]d18720a2012-01-06 09:53:5563}
64
[email protected]d22e800e2014-05-28 21:55:5765bool LayeredResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0566 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5767 return next_handler_->OnReadCompleted(bytes_read, defer);
[email protected]d18720a2012-01-06 09:53:5568}
69
[email protected]3780874a2013-11-18 05:49:0370void LayeredResourceHandler::OnResponseCompleted(
[email protected]d18720a2012-01-06 09:53:5571 const net::URLRequestStatus& status,
[email protected]3780874a2013-11-18 05:49:0372 const std::string& security_info,
73 bool* defer) {
[email protected]d651cbc2012-05-31 21:33:0574 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5775 next_handler_->OnResponseCompleted(status, security_info, defer);
[email protected]d18720a2012-01-06 09:53:5576}
77
[email protected]d22e800e2014-05-28 21:55:5778void LayeredResourceHandler::OnDataDownloaded(int bytes_downloaded) {
[email protected]d651cbc2012-05-31 21:33:0579 DCHECK(next_handler_.get());
[email protected]d22e800e2014-05-28 21:55:5780 next_handler_->OnDataDownloaded(bytes_downloaded);
[email protected]d18720a2012-01-06 09:53:5581}
82
[email protected]d18720a2012-01-06 09:53:5583} // namespace content