Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: content/browser/loader/navigation_resource_handler.cc

Issue 1416953007: Add a function to add extra headers from NavigationThrottle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data-reduction-proxy-resource-throttle
Patch Set: Fixed compilation issue Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/loader/navigation_resource_handler.h" 5 #include "content/browser/loader/navigation_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/devtools/devtools_netlog_observer.h" 8 #include "content/browser/devtools/devtools_netlog_observer.h"
9 #include "content/browser/loader/navigation_url_loader_impl_core.h" 9 #include "content/browser/loader/navigation_url_loader_impl_core.h"
10 #include "content/browser/loader/resource_request_info_impl.h" 10 #include "content/browser/loader/resource_request_info_impl.h"
(...skipping 22 matching lines...) Expand all
33 core_->NotifyRequestFailed(false, net::ERR_ABORTED); 33 core_->NotifyRequestFailed(false, net::ERR_ABORTED);
34 DetachFromCore(); 34 DetachFromCore();
35 } 35 }
36 } 36 }
37 37
38 void NavigationResourceHandler::Cancel() { 38 void NavigationResourceHandler::Cancel() {
39 controller()->Cancel(); 39 controller()->Cancel();
40 core_ = nullptr; 40 core_ = nullptr;
41 } 41 }
42 42
43 void NavigationResourceHandler::FollowRedirect() { 43 void NavigationResourceHandler::FollowRedirect(
44 const std::vector<std::pair<std::string, std::string>>& extra_headers) {
45 for (auto header : extra_headers)
46 request()->SetExtraRequestHeaderByName(header.first, header.second, true);
44 controller()->Resume(); 47 controller()->Resume();
45 } 48 }
46 49
47 void NavigationResourceHandler::SetController(ResourceController* controller) { 50 void NavigationResourceHandler::SetController(ResourceController* controller) {
48 writer_.set_controller(controller); 51 writer_.set_controller(controller);
49 ResourceHandler::SetController(controller); 52 ResourceHandler::SetController(controller);
50 } 53 }
51 54
52 bool NavigationResourceHandler::OnRequestRedirected( 55 bool NavigationResourceHandler::OnRequestRedirected(
53 const net::RedirectInfo& redirect_info, 56 const net::RedirectInfo& redirect_info,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 NOTREACHED(); 141 NOTREACHED();
139 } 142 }
140 143
141 void NavigationResourceHandler::DetachFromCore() { 144 void NavigationResourceHandler::DetachFromCore() {
142 DCHECK(core_); 145 DCHECK(core_);
143 core_->set_resource_handler(nullptr); 146 core_->set_resource_handler(nullptr);
144 core_ = nullptr; 147 core_ = nullptr;
145 } 148 }
146 149
147 } // namespace content 150 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698