| 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| 11 #include "base/guid.h" | 11 #include "base/guid.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/component_updater/component_updater_resource_throttle.h
" | 15 #include "chrome/browser/component_updater/component_updater_resource_throttle.h
" |
| 16 #include "chrome/browser/download/download_request_limiter.h" | 16 #include "chrome/browser/download/download_request_limiter.h" |
| 17 #include "chrome/browser/download/download_resource_throttle.h" | 17 #include "chrome/browser/download/download_resource_throttle.h" |
| 18 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" | 18 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" |
| 19 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 19 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 20 #include "chrome/browser/plugins/plugin_prefs.h" | 20 #include "chrome/browser/plugins/plugin_prefs.h" |
| 21 #include "chrome/browser/prefetch/prefetch.h" | 21 #include "chrome/browser/prefetch/prefetch.h" |
| 22 #include "chrome/browser/prerender/prerender_manager.h" | 22 #include "chrome/browser/prerender/prerender_manager.h" |
| 23 #include "chrome/browser/prerender/prerender_manager_factory.h" | 23 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 24 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 24 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
| 25 #include "chrome/browser/prerender/prerender_util.h" | 25 #include "chrome/browser/prerender/prerender_util.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/profiles/profile_io_data.h" | 27 #include "chrome/browser/profiles/profile_io_data.h" |
| 28 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an
droid.h" | |
| 29 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 28 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 30 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" | 29 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" |
| 31 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 30 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 32 #include "chrome/browser/signin/chrome_signin_helper.h" | 31 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 33 #include "chrome/browser/tab_contents/tab_util.h" | 32 #include "chrome/browser/tab_contents/tab_util.h" |
| 34 #include "chrome/browser/ui/login/login_prompt.h" | 33 #include "chrome/browser/ui/login/login_prompt.h" |
| 35 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/features.h" |
| 36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| 37 #include "components/content_settings/core/browser/host_content_settings_map.h" | 37 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 38 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 38 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 39 #include "components/google/core/browser/google_util.h" | 39 #include "components/google/core/browser/google_util.h" |
| 40 #include "components/variations/net/variations_http_header_provider.h" | 40 #include "components/variations/net/variations_http_header_provider.h" |
| 41 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
| 42 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 43 #include "content/public/browser/plugin_service.h" | 43 #include "content/public/browser/plugin_service.h" |
| 44 #include "content/public/browser/plugin_service_filter.h" | 44 #include "content/public/browser/plugin_service_filter.h" |
| 45 #include "content/public/browser/render_process_host.h" | 45 #include "content/public/browser/render_process_host.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #if defined(ENABLE_SUPERVISED_USERS) | 81 #if defined(ENABLE_SUPERVISED_USERS) |
| 82 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" | 82 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 #if defined(USE_SYSTEM_PROTOBUF) | 85 #if defined(USE_SYSTEM_PROTOBUF) |
| 86 #include <google/protobuf/repeated_field.h> | 86 #include <google/protobuf/repeated_field.h> |
| 87 #else | 87 #else |
| 88 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 88 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 92 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
| 93 #endif |
| 94 |
| 91 #if defined(OS_ANDROID) | 95 #if defined(OS_ANDROID) |
| 92 #include "chrome/browser/android/intercept_download_resource_throttle.h" | 96 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an
droid.h" |
| 93 #include "components/navigation_interception/intercept_navigation_delegate.h" | 97 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 94 #endif | 98 #endif |
| 95 | 99 |
| 96 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 100 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
| 97 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_d
ebug_resource_throttle.h" | 101 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_d
ebug_resource_throttle.h" |
| 98 #endif | 102 #endif |
| 99 | 103 |
| 100 #if defined(OS_CHROMEOS) | 104 #if defined(OS_CHROMEOS) |
| 101 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h
" | 105 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h
" |
| 102 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" | 106 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 BrowserThread::UI, FROM_HERE, | 421 BrowserThread::UI, FROM_HERE, |
| 418 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); | 422 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); |
| 419 | 423 |
| 420 // If it's from the web, we don't trust it, so we push the throttle on. | 424 // If it's from the web, we don't trust it, so we push the throttle on. |
| 421 if (is_content_initiated) { | 425 if (is_content_initiated) { |
| 422 const content::ResourceRequestInfo* info = | 426 const content::ResourceRequestInfo* info = |
| 423 content::ResourceRequestInfo::ForRequest(request); | 427 content::ResourceRequestInfo::ForRequest(request); |
| 424 throttles->push_back(new DownloadResourceThrottle( | 428 throttles->push_back(new DownloadResourceThrottle( |
| 425 download_request_limiter_, info->GetWebContentsGetterForRequest(), | 429 download_request_limiter_, info->GetWebContentsGetterForRequest(), |
| 426 request->url(), request->method())); | 430 request->url(), request->method())); |
| 427 #if defined(OS_ANDROID) | 431 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 428 throttles->push_back( | 432 throttles->push_back( |
| 429 new chrome::InterceptDownloadResourceThrottle( | 433 new chrome::InterceptDownloadResourceThrottle( |
| 430 request, child_id, route_id, request_id)); | 434 request, child_id, route_id, request_id)); |
| 431 #endif | 435 #endif |
| 432 } | 436 } |
| 433 | 437 |
| 434 // If this isn't a new request, we've seen this before and added the standard | 438 // If this isn't a new request, we've seen this before and added the standard |
| 435 // resource throttles already so no need to add it again. | 439 // resource throttles already so no need to add it again. |
| 436 if (!request->is_pending()) { | 440 if (!request->is_pending()) { |
| 437 AppendStandardResourceThrottles(request, | 441 AppendStandardResourceThrottles(request, |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); | 743 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); |
| 740 return false; | 744 return false; |
| 741 } | 745 } |
| 742 | 746 |
| 743 // static | 747 // static |
| 744 void ChromeResourceDispatcherHostDelegate:: | 748 void ChromeResourceDispatcherHostDelegate:: |
| 745 SetExternalProtocolHandlerDelegateForTesting( | 749 SetExternalProtocolHandlerDelegateForTesting( |
| 746 ExternalProtocolHandler::Delegate* delegate) { | 750 ExternalProtocolHandler::Delegate* delegate) { |
| 747 g_external_protocol_handler_delegate = delegate; | 751 g_external_protocol_handler_delegate = delegate; |
| 748 } | 752 } |
| OLD | NEW |