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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #include "chrome/browser/printing/printing_message_filter.h" | 68 #include "chrome/browser/printing/printing_message_filter.h" |
69 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 69 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
70 #include "chrome/browser/profiles/profile.h" | 70 #include "chrome/browser/profiles/profile.h" |
71 #include "chrome/browser/profiles/profile_io_data.h" | 71 #include "chrome/browser/profiles/profile_io_data.h" |
72 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" | 72 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" |
73 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 73 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
74 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" | 74 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" |
75 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" | 75 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" |
76 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" | 76 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" |
77 #include "chrome/browser/safe_browsing/mojo_safe_browsing_impl.h" | 77 #include "chrome/browser/safe_browsing/mojo_safe_browsing_impl.h" |
| 78 #include "chrome/browser/safe_browsing/safe_browsing_browser_throttle.h" |
78 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 79 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
79 #include "chrome/browser/search/instant_service.h" | 80 #include "chrome/browser/search/instant_service.h" |
80 #include "chrome/browser/search/instant_service_factory.h" | 81 #include "chrome/browser/search/instant_service_factory.h" |
81 #include "chrome/browser/search/search.h" | 82 #include "chrome/browser/search/search.h" |
82 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" | 83 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" |
83 #include "chrome/browser/speech/tts_controller.h" | 84 #include "chrome/browser/speech/tts_controller.h" |
84 #include "chrome/browser/speech/tts_message_filter.h" | 85 #include "chrome/browser/speech/tts_message_filter.h" |
85 #include "chrome/browser/ssl/ssl_blocking_page.h" | 86 #include "chrome/browser/ssl/ssl_blocking_page.h" |
86 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 87 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
87 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" | 88 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 #include "content/public/browser/storage_partition.h" | 181 #include "content/public/browser/storage_partition.h" |
181 #include "content/public/browser/vpn_service_proxy.h" | 182 #include "content/public/browser/vpn_service_proxy.h" |
182 #include "content/public/browser/web_contents.h" | 183 #include "content/public/browser/web_contents.h" |
183 #include "content/public/common/child_process_host.h" | 184 #include "content/public/common/child_process_host.h" |
184 #include "content/public/common/content_descriptors.h" | 185 #include "content/public/common/content_descriptors.h" |
185 #include "content/public/common/content_features.h" | 186 #include "content/public/common/content_features.h" |
186 #include "content/public/common/content_switches.h" | 187 #include "content/public/common/content_switches.h" |
187 #include "content/public/common/sandbox_type.h" | 188 #include "content/public/common/sandbox_type.h" |
188 #include "content/public/common/service_manager_connection.h" | 189 #include "content/public/common/service_manager_connection.h" |
189 #include "content/public/common/service_names.mojom.h" | 190 #include "content/public/common/service_names.mojom.h" |
| 191 #include "content/public/common/url_loader_throttle.h" |
190 #include "content/public/common/url_utils.h" | 192 #include "content/public/common/url_utils.h" |
191 #include "content/public/common/web_preferences.h" | 193 #include "content/public/common/web_preferences.h" |
192 #include "device/bluetooth/adapter_factory.h" | 194 #include "device/bluetooth/adapter_factory.h" |
193 #include "device/bluetooth/public/interfaces/adapter.mojom.h" | 195 #include "device/bluetooth/public/interfaces/adapter.mojom.h" |
194 #include "device/usb/public/interfaces/chooser_service.mojom.h" | 196 #include "device/usb/public/interfaces/chooser_service.mojom.h" |
195 #include "device/usb/public/interfaces/device_manager.mojom.h" | 197 #include "device/usb/public/interfaces/device_manager.mojom.h" |
196 #include "extensions/features/features.h" | 198 #include "extensions/features/features.h" |
197 #include "gpu/config/gpu_switches.h" | 199 #include "gpu/config/gpu_switches.h" |
198 #include "media/audio/audio_manager.h" | 200 #include "media/audio/audio_manager.h" |
199 #include "media/media_features.h" | 201 #include "media/media_features.h" |
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 } | 2512 } |
2511 return false; | 2513 return false; |
2512 } | 2514 } |
2513 #endif | 2515 #endif |
2514 | 2516 |
2515 return true; | 2517 return true; |
2516 } | 2518 } |
2517 | 2519 |
2518 void ChromeContentBrowserClient::ResourceDispatcherHostCreated() { | 2520 void ChromeContentBrowserClient::ResourceDispatcherHostCreated() { |
2519 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2521 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2522 |
| 2523 safe_browsing_ = g_browser_process->safe_browsing_service(); |
| 2524 |
2520 for (size_t i = 0; i < extra_parts_.size(); ++i) | 2525 for (size_t i = 0; i < extra_parts_.size(); ++i) |
2521 extra_parts_[i]->ResourceDispatcherHostCreated(); | 2526 extra_parts_[i]->ResourceDispatcherHostCreated(); |
2522 | 2527 |
2523 return g_browser_process->ResourceDispatcherHostCreated(); | 2528 return g_browser_process->ResourceDispatcherHostCreated(); |
2524 } | 2529 } |
2525 | 2530 |
2526 content::SpeechRecognitionManagerDelegate* | 2531 content::SpeechRecognitionManagerDelegate* |
2527 ChromeContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { | 2532 ChromeContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { |
2528 return new speech::ChromeSpeechRecognitionManagerDelegate(); | 2533 return new speech::ChromeSpeechRecognitionManagerDelegate(); |
2529 } | 2534 } |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); | 2997 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); |
2993 net::URLRequestContextGetter* context = | 2998 net::URLRequestContextGetter* context = |
2994 render_process_host->GetStoragePartition()->GetURLRequestContext(); | 2999 render_process_host->GetStoragePartition()->GetURLRequestContext(); |
2995 registry->AddInterface( | 3000 registry->AddInterface( |
2996 base::Bind(&NetBenchmarking::Create, profile, context)); | 3001 base::Bind(&NetBenchmarking::Create, profile, context)); |
2997 } | 3002 } |
2998 | 3003 |
2999 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 3004 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
3000 switches::kEnableNetworkService)) { | 3005 switches::kEnableNetworkService)) { |
3001 registry->AddInterface( | 3006 registry->AddInterface( |
3002 base::Bind( | 3007 base::Bind(&safe_browsing::MojoSafeBrowsingImpl::Create, |
3003 &safe_browsing::MojoSafeBrowsingImpl::Create, | 3008 safe_browsing_->database_manager(), |
3004 g_browser_process->safe_browsing_service()->database_manager(), | 3009 safe_browsing_->ui_manager(), render_process_host->GetID()), |
3005 g_browser_process->safe_browsing_service()->ui_manager(), | |
3006 render_process_host->GetID()), | |
3007 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 3010 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
3008 } | 3011 } |
3009 | 3012 |
3010 #if defined(OS_WIN) | 3013 #if defined(OS_WIN) |
3011 if (base::FeatureList::IsEnabled(features::kModuleDatabase)) { | 3014 if (base::FeatureList::IsEnabled(features::kModuleDatabase)) { |
3012 // Add the ModuleDatabase interface. This is the interface used by renderer | 3015 // Add the ModuleDatabase interface. This is the interface used by renderer |
3013 // processes to notify the browser of modules in their address space. It | 3016 // processes to notify the browser of modules in their address space. It |
3014 // ultimately drives the chrome://conflicts UI. The process handle is not | 3017 // ultimately drives the chrome://conflicts UI. The process handle is not |
3015 // yet available at this point so pass in a callback to allow it to be | 3018 // yet available at this point so pass in a callback to allow it to be |
3016 // retrieved at the time the interface is actually created. It is safe to | 3019 // retrieved at the time the interface is actually created. It is safe to |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 return variations::GetVariationParamValue( | 3502 return variations::GetVariationParamValue( |
3500 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; | 3503 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; |
3501 } | 3504 } |
3502 | 3505 |
3503 bool ChromeContentBrowserClient:: | 3506 bool ChromeContentBrowserClient:: |
3504 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3507 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3505 return variations::GetVariationParamValue( | 3508 return variations::GetVariationParamValue( |
3506 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3509 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3507 } | 3510 } |
3508 | 3511 |
| 3512 std::vector<std::unique_ptr<content::URLLoaderThrottle>> |
| 3513 ChromeContentBrowserClient::CreateURLLoaderThrottles( |
| 3514 const base::Callback<content::WebContents*()>& wc_getter) { |
| 3515 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 3516 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 3517 switches::kEnableNetworkService)); |
| 3518 |
| 3519 std::vector<std::unique_ptr<content::URLLoaderThrottle>> result; |
| 3520 result.push_back(base::MakeUnique<safe_browsing::SafeBrowsingBrowserThrottle>( |
| 3521 safe_browsing_->database_manager(), safe_browsing_->ui_manager(), |
| 3522 wc_getter)); |
| 3523 return result; |
| 3524 } |
| 3525 |
3509 // static | 3526 // static |
3510 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3527 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3511 const storage::QuotaSettings* settings) { | 3528 const storage::QuotaSettings* settings) { |
3512 g_default_quota_settings = settings; | 3529 g_default_quota_settings = settings; |
3513 } | 3530 } |
OLD | NEW |