Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / loader / layered_resource_handler.cc
blobfa15b0de40f7516e6410a2ac225cdde52688821c
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::OnUploadProgress(uint64 position,
33 uint64 size) {
34 DCHECK(next_handler_.get());
35 return next_handler_->OnUploadProgress(position, size);
38 bool LayeredResourceHandler::OnRequestRedirected(
39 const net::RedirectInfo& redirect_info,
40 ResourceResponse* response,
41 bool* defer) {
42 DCHECK(next_handler_.get());
43 return next_handler_->OnRequestRedirected(redirect_info, response, defer);
46 bool LayeredResourceHandler::OnResponseStarted(ResourceResponse* response,
47 bool* defer) {
48 DCHECK(next_handler_.get());
49 return next_handler_->OnResponseStarted(response, defer);
52 bool LayeredResourceHandler::OnWillStart(const GURL& url,
53 bool* defer) {
54 DCHECK(next_handler_.get());
55 return next_handler_->OnWillStart(url, defer);
58 bool LayeredResourceHandler::OnBeforeNetworkStart(const GURL& url,
59 bool* defer) {
60 DCHECK(next_handler_.get());
61 return next_handler_->OnBeforeNetworkStart(url, defer);
64 bool LayeredResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
65 int* buf_size,
66 int min_size) {
67 DCHECK(next_handler_.get());
68 return next_handler_->OnWillRead(buf, buf_size, min_size);
71 bool LayeredResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
72 DCHECK(next_handler_.get());
73 return next_handler_->OnReadCompleted(bytes_read, defer);
76 void LayeredResourceHandler::OnResponseCompleted(
77 const net::URLRequestStatus& status,
78 const std::string& security_info,
79 bool* defer) {
80 DCHECK(next_handler_.get());
81 next_handler_->OnResponseCompleted(status, security_info, defer);
84 void LayeredResourceHandler::OnDataDownloaded(int bytes_downloaded) {
85 DCHECK(next_handler_.get());
86 next_handler_->OnDataDownloaded(bytes_downloaded);
89 } // namespace content