Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / loader / layered_resource_handler.cc
blob00048ae520afd486eabf9b4b9ea09be321aec408
1 // 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.
5 #include "content/browser/loader/layered_resource_handler.h"
7 #include "base/logging.h"
9 namespace content {
11 LayeredResourceHandler::LayeredResourceHandler(
12 net::URLRequest* request,
13 scoped_ptr<ResourceHandler> next_handler)
14 : ResourceHandler(request),
15 next_handler_(next_handler.Pass()) {
18 LayeredResourceHandler::~LayeredResourceHandler() {
21 void LayeredResourceHandler::SetController(ResourceController* controller) {
22 ResourceHandler::SetController(controller);
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.
28 DCHECK(next_handler_.get());
29 next_handler_->SetController(controller);
32 bool LayeredResourceHandler::OnRequestRedirected(
33 const net::RedirectInfo& redirect_info,
34 ResourceResponse* response,
35 bool* defer) {
36 DCHECK(next_handler_.get());
37 return next_handler_->OnRequestRedirected(redirect_info, response, defer);
40 bool LayeredResourceHandler::OnResponseStarted(ResourceResponse* response,
41 bool* defer) {
42 DCHECK(next_handler_.get());
43 return next_handler_->OnResponseStarted(response, defer);
46 bool LayeredResourceHandler::OnWillStart(const GURL& url,
47 bool* defer) {
48 DCHECK(next_handler_.get());
49 return next_handler_->OnWillStart(url, defer);
52 bool LayeredResourceHandler::OnBeforeNetworkStart(const GURL& url,
53 bool* defer) {
54 DCHECK(next_handler_.get());
55 return next_handler_->OnBeforeNetworkStart(url, defer);
58 bool LayeredResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
59 int* buf_size,
60 int min_size) {
61 DCHECK(next_handler_.get());
62 return next_handler_->OnWillRead(buf, buf_size, min_size);
65 bool LayeredResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
66 DCHECK(next_handler_.get());
67 return next_handler_->OnReadCompleted(bytes_read, defer);
70 void LayeredResourceHandler::OnResponseCompleted(
71 const net::URLRequestStatus& status,
72 const std::string& security_info,
73 bool* defer) {
74 DCHECK(next_handler_.get());
75 next_handler_->OnResponseCompleted(status, security_info, defer);
78 void LayeredResourceHandler::OnDataDownloaded(int bytes_downloaded) {
79 DCHECK(next_handler_.get());
80 next_handler_->OnDataDownloaded(bytes_downloaded);
83 } // namespace content