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 "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 int request_id, | 181 int request_id, |
182 bool is_content_initiated, | 182 bool is_content_initiated, |
183 ScopedVector<content::ResourceThrottle>* throttles) { | 183 ScopedVector<content::ResourceThrottle>* throttles) { |
184 BrowserThread::PostTask( | 184 BrowserThread::PostTask( |
185 BrowserThread::UI, FROM_HERE, | 185 BrowserThread::UI, FROM_HERE, |
186 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); | 186 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); |
187 | 187 |
188 // If it's from the web, we don't trust it, so we push the throttle on. | 188 // If it's from the web, we don't trust it, so we push the throttle on. |
189 if (is_content_initiated) { | 189 if (is_content_initiated) { |
190 throttles->push_back(new DownloadResourceThrottle( | 190 throttles->push_back(new DownloadResourceThrottle( |
191 download_request_limiter_, child_id, route_id, request_id, | 191 download_request_limiter_.get(), child_id, route_id, request_id, |
192 request->method())); | 192 request->method())); |
193 } | 193 } |
194 | 194 |
195 // If this isn't a new request, we've seen this before and added the standard | 195 // If this isn't a new request, we've seen this before and added the standard |
196 // resource throttles already so no need to add it again. | 196 // resource throttles already so no need to add it again. |
197 if (!request->is_pending()) { | 197 if (!request->is_pending()) { |
198 AppendStandardResourceThrottles(request, | 198 AppendStandardResourceThrottles(request, |
199 resource_context, | 199 resource_context, |
200 child_id, | 200 child_id, |
201 route_id, | 201 route_id, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 int route_id, | 274 int route_id, |
275 ResourceType::Type resource_type, | 275 ResourceType::Type resource_type, |
276 ScopedVector<content::ResourceThrottle>* throttles) { | 276 ScopedVector<content::ResourceThrottle>* throttles) { |
277 #if defined(ENABLE_SAFE_BROWSING) | 277 #if defined(ENABLE_SAFE_BROWSING) |
278 // Insert safe browsing at the front of the list, so it gets to decide on | 278 // Insert safe browsing at the front of the list, so it gets to decide on |
279 // policies first. | 279 // policies first. |
280 bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME; | 280 bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME; |
281 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 281 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
282 if (io_data->safe_browsing_enabled()->GetValue()) { | 282 if (io_data->safe_browsing_enabled()->GetValue()) { |
283 throttles->push_back(SafeBrowsingResourceThrottle::Create( | 283 throttles->push_back(SafeBrowsingResourceThrottle::Create( |
284 request, child_id, route_id, is_subresource_request, safe_browsing_)); | 284 request, child_id, route_id, is_subresource_request, |
| 285 safe_browsing_.get())); |
285 } | 286 } |
286 #endif | 287 #endif |
287 | 288 |
288 content::ResourceThrottle* throttle = | 289 content::ResourceThrottle* throttle = |
289 user_script_listener_->CreateResourceThrottle(request->url(), | 290 user_script_listener_->CreateResourceThrottle(request->url(), |
290 resource_type); | 291 resource_type); |
291 if (throttle) | 292 if (throttle) |
292 throttles->push_back(throttle); | 293 throttles->push_back(throttle); |
293 } | 294 } |
294 | 295 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 if (base::Base64Encode(serialized, &hashed)) { | 478 if (base::Base64Encode(serialized, &hashed)) { |
478 // If successful, swap the header value with the new one. | 479 // If successful, swap the header value with the new one. |
479 // Note that the list of IDs and the header could be temporarily out of sync | 480 // Note that the list of IDs and the header could be temporarily out of sync |
480 // if IDs are added as the header is recreated. The receiving servers are OK | 481 // if IDs are added as the header is recreated. The receiving servers are OK |
481 // with such descrepancies. | 482 // with such descrepancies. |
482 variation_ids_header_ = hashed; | 483 variation_ids_header_ = hashed; |
483 } else { | 484 } else { |
484 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; | 485 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; |
485 } | 486 } |
486 } | 487 } |
OLD | NEW |