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

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

Issue 893843003: Add RedirectInfo as a redirect parameter to ResourceThrottles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document ResourceThrottle Created 5 years, 10 months 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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/throttling_resource_handler.h" 5 #include "content/browser/loader/throttling_resource_handler.h"
6 6
7 #include "content/browser/loader/resource_request_info_impl.h" 7 #include "content/browser/loader/resource_request_info_impl.h"
8 #include "content/public/browser/resource_throttle.h" 8 #include "content/public/browser/resource_throttle.h"
9 #include "content/public/common/resource_response.h" 9 #include "content/public/common/resource_response.h"
10 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
(...skipping 22 matching lines...) Expand all
33 33
34 bool ThrottlingResourceHandler::OnRequestRedirected( 34 bool ThrottlingResourceHandler::OnRequestRedirected(
35 const net::RedirectInfo& redirect_info, 35 const net::RedirectInfo& redirect_info,
36 ResourceResponse* response, 36 ResourceResponse* response,
37 bool* defer) { 37 bool* defer) {
38 DCHECK(!cancelled_by_resource_throttle_); 38 DCHECK(!cancelled_by_resource_throttle_);
39 39
40 *defer = false; 40 *defer = false;
41 while (next_index_ < throttles_.size()) { 41 while (next_index_ < throttles_.size()) {
42 int index = next_index_; 42 int index = next_index_;
43 throttles_[index]->WillRedirectRequest(redirect_info.new_url, defer); 43 throttles_[index]->WillRedirectRequest(redirect_info, defer);
44 next_index_++; 44 next_index_++;
45 if (cancelled_by_resource_throttle_) 45 if (cancelled_by_resource_throttle_)
46 return false; 46 return false;
47 if (*defer) { 47 if (*defer) {
48 OnRequestDefered(index); 48 OnRequestDefered(index);
49 deferred_stage_ = DEFERRED_REDIRECT; 49 deferred_stage_ = DEFERRED_REDIRECT;
50 deferred_redirect_ = redirect_info; 50 deferred_redirect_ = redirect_info;
51 deferred_response_ = response; 51 deferred_response_ = response;
52 return true; // Do not cancel. 52 return true; // Do not cancel.
53 } 53 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } else if (!defer) { 225 } else if (!defer) {
226 controller()->Resume(); 226 controller()->Resume();
227 } 227 }
228 } 228 }
229 229
230 void ThrottlingResourceHandler::OnRequestDefered(int throttle_index) { 230 void ThrottlingResourceHandler::OnRequestDefered(int throttle_index) {
231 request()->LogBlockedBy(throttles_[throttle_index]->GetNameForLogging()); 231 request()->LogBlockedBy(throttles_[throttle_index]->GetNameForLogging());
232 } 232 }
233 233
234 } // namespace content 234 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698