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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 int request_id, | 277 int request_id, |
278 bool is_content_initiated, | 278 bool is_content_initiated, |
279 bool must_download, | 279 bool must_download, |
280 ScopedVector<content::ResourceThrottle>* throttles) { | 280 ScopedVector<content::ResourceThrottle>* throttles) { |
281 BrowserThread::PostTask( | 281 BrowserThread::PostTask( |
282 BrowserThread::UI, FROM_HERE, | 282 BrowserThread::UI, FROM_HERE, |
283 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); | 283 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); |
284 | 284 |
285 // If it's from the web, we don't trust it, so we push the throttle on. | 285 // If it's from the web, we don't trust it, so we push the throttle on. |
286 if (is_content_initiated) { | 286 if (is_content_initiated) { |
287 throttles->push_back(new DownloadResourceThrottle( | 287 throttles->push_back( |
288 download_request_limiter_, child_id, route_id, request_id, | 288 new DownloadResourceThrottle(download_request_limiter_.get(), |
289 request->method())); | 289 child_id, |
| 290 route_id, |
| 291 request_id, |
| 292 request->method())); |
290 #if defined(OS_ANDROID) | 293 #if defined(OS_ANDROID) |
291 throttles->push_back( | 294 throttles->push_back( |
292 new chrome::InterceptDownloadResourceThrottle( | 295 new chrome::InterceptDownloadResourceThrottle( |
293 request, child_id, route_id, request_id)); | 296 request, child_id, route_id, request_id)); |
294 #endif | 297 #endif |
295 } | 298 } |
296 | 299 |
297 // If this isn't a new request, we've seen this before and added the standard | 300 // If this isn't a new request, we've seen this before and added the standard |
298 // resource throttles already so no need to add it again. | 301 // resource throttles already so no need to add it again. |
299 if (!request->is_pending()) { | 302 if (!request->is_pending()) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 int route_id, | 386 int route_id, |
384 ResourceType::Type resource_type, | 387 ResourceType::Type resource_type, |
385 ScopedVector<content::ResourceThrottle>* throttles) { | 388 ScopedVector<content::ResourceThrottle>* throttles) { |
386 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 389 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
387 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 390 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) |
388 // Insert safe browsing at the front of the list, so it gets to decide on | 391 // Insert safe browsing at the front of the list, so it gets to decide on |
389 // policies first. | 392 // policies first. |
390 if (io_data->safe_browsing_enabled()->GetValue()) { | 393 if (io_data->safe_browsing_enabled()->GetValue()) { |
391 bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME; | 394 bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME; |
392 content::ResourceThrottle* throttle = | 395 content::ResourceThrottle* throttle = |
393 SafeBrowsingResourceThrottleFactory::Create(request, child_id, route_id, | 396 SafeBrowsingResourceThrottleFactory::Create(request, |
394 is_subresource_request, safe_browsing_); | 397 child_id, |
| 398 route_id, |
| 399 is_subresource_request, |
| 400 safe_browsing_.get()); |
395 if (throttle) | 401 if (throttle) |
396 throttles->push_back(throttle); | 402 throttles->push_back(throttle); |
397 } | 403 } |
398 #endif | 404 #endif |
399 | 405 |
400 #if defined(ENABLE_MANAGED_USERS) | 406 #if defined(ENABLE_MANAGED_USERS) |
401 bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME; | 407 bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME; |
402 throttles->push_back(new ManagedModeResourceThrottle( | 408 throttles->push_back(new ManagedModeResourceThrottle( |
403 request, child_id, route_id, !is_subresource_request, | 409 request, child_id, route_id, !is_subresource_request, |
404 io_data->managed_mode_url_filter())); | 410 io_data->managed_mode_url_filter())); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 int child_id, route_id; | 590 int child_id, route_id; |
585 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && | 591 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && |
586 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | 592 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( |
587 &child_id, &route_id) && | 593 &child_id, &route_id) && |
588 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { | 594 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { |
589 prerender_tracker_->TryCancel( | 595 prerender_tracker_->TryCancel( |
590 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); | 596 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); |
591 request->Cancel(); | 597 request->Cancel(); |
592 } | 598 } |
593 } | 599 } |
OLD | NEW |