OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |