| 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 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/browser/browser_process.h" | 34 #include "chrome/browser/browser_process.h" |
| 35 #include "chrome/browser/browser_shutdown.h" | 35 #include "chrome/browser/browser_shutdown.h" |
| 36 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 36 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 37 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 37 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 38 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 38 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 39 #include "chrome/browser/browsing_data/origin_filter_builder.h" | 39 #include "chrome/browser/browsing_data/origin_filter_builder.h" |
| 40 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" | 40 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" |
| 41 #include "chrome/browser/budget_service/budget_service_impl.h" | 41 #include "chrome/browser/budget_service/budget_service_impl.h" |
| 42 #include "chrome/browser/character_encoding.h" | 42 #include "chrome/browser/character_encoding.h" |
| 43 #include "chrome/browser/chrome_content_browser_client_parts.h" | 43 #include "chrome/browser/chrome_content_browser_client_parts.h" |
| 44 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | |
| 45 #include "chrome/browser/chrome_quota_permission_context.h" | 44 #include "chrome/browser/chrome_quota_permission_context.h" |
| 46 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 45 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 47 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 46 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 48 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 47 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 49 #include "chrome/browser/defaults.h" | 48 #include "chrome/browser/defaults.h" |
| 50 #include "chrome/browser/download/download_prefs.h" | 49 #include "chrome/browser/download/download_prefs.h" |
| 51 #include "chrome/browser/field_trial_recorder.h" | 50 #include "chrome/browser/field_trial_recorder.h" |
| 52 #include "chrome/browser/font_family_cache.h" | 51 #include "chrome/browser/font_family_cache.h" |
| 53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 52 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" | 53 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" |
| 55 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 54 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 56 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 55 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 56 #include "chrome/browser/net_benchmarking.h" |
| 57 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 57 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 58 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" | 58 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" |
| 59 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 59 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 60 #include "chrome/browser/payments/payment_request_impl.h" | 60 #include "chrome/browser/payments/payment_request_impl.h" |
| 61 #include "chrome/browser/permissions/permission_context_base.h" | 61 #include "chrome/browser/permissions/permission_context_base.h" |
| 62 #include "chrome/browser/platform_util.h" | 62 #include "chrome/browser/platform_util.h" |
| 63 #include "chrome/browser/prerender/prerender_final_status.h" | 63 #include "chrome/browser/prerender/prerender_final_status.h" |
| 64 #include "chrome/browser/prerender/prerender_manager.h" | 64 #include "chrome/browser/prerender/prerender_manager.h" |
| 65 #include "chrome/browser/prerender/prerender_manager_factory.h" | 65 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 66 #include "chrome/browser/prerender/prerender_message_filter.h" | 66 #include "chrome/browser/prerender/prerender_message_filter.h" |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 content::WebContentsViewDelegate* | 1031 content::WebContentsViewDelegate* |
| 1032 ChromeContentBrowserClient::GetWebContentsViewDelegate( | 1032 ChromeContentBrowserClient::GetWebContentsViewDelegate( |
| 1033 content::WebContents* web_contents) { | 1033 content::WebContents* web_contents) { |
| 1034 return chrome::CreateWebContentsViewDelegate(web_contents); | 1034 return chrome::CreateWebContentsViewDelegate(web_contents); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 void ChromeContentBrowserClient::RenderProcessWillLaunch( | 1037 void ChromeContentBrowserClient::RenderProcessWillLaunch( |
| 1038 content::RenderProcessHost* host) { | 1038 content::RenderProcessHost* host) { |
| 1039 int id = host->GetID(); | 1039 int id = host->GetID(); |
| 1040 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1040 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 1041 net::URLRequestContextGetter* context = | |
| 1042 host->GetStoragePartition()->GetURLRequestContext(); | |
| 1043 | |
| 1044 host->AddFilter(new ChromeRenderMessageFilter( | 1041 host->AddFilter(new ChromeRenderMessageFilter( |
| 1045 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); | 1042 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); |
| 1046 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1043 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1047 host->AddFilter(new cast::CastTransportHostFilter); | 1044 host->AddFilter(new cast::CastTransportHostFilter); |
| 1048 #endif | 1045 #endif |
| 1049 #if BUILDFLAG(ENABLE_PRINTING) | 1046 #if BUILDFLAG(ENABLE_PRINTING) |
| 1050 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); | 1047 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); |
| 1051 #endif | 1048 #endif |
| 1052 #if BUILDFLAG(ENABLE_SPELLCHECK) | 1049 #if BUILDFLAG(ENABLE_SPELLCHECK) |
| 1053 host->AddFilter(new SpellCheckMessageFilter(id)); | 1050 host->AddFilter(new SpellCheckMessageFilter(id)); |
| 1054 #endif | 1051 #endif |
| 1055 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 1052 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 1056 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); | 1053 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); |
| 1057 #endif | 1054 #endif |
| 1058 host->AddFilter(new ChromeNetBenchmarkingMessageFilter(profile, context)); | |
| 1059 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); | 1055 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); |
| 1060 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); | 1056 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); |
| 1061 #if BUILDFLAG(ENABLE_WEBRTC) | 1057 #if BUILDFLAG(ENABLE_WEBRTC) |
| 1062 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = | 1058 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = |
| 1063 new WebRtcLoggingHandlerHost(id, profile, | 1059 new WebRtcLoggingHandlerHost(id, profile, |
| 1064 g_browser_process->webrtc_log_uploader()); | 1060 g_browser_process->webrtc_log_uploader()); |
| 1065 host->AddFilter(webrtc_logging_handler_host); | 1061 host->AddFilter(webrtc_logging_handler_host); |
| 1066 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, | 1062 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, |
| 1067 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( | 1063 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( |
| 1068 webrtc_logging_handler_host)); | 1064 webrtc_logging_handler_host)); |
| 1069 | 1065 |
| 1070 AudioDebugRecordingsHandler* audio_debug_recordings_handler = | 1066 AudioDebugRecordingsHandler* audio_debug_recordings_handler = |
| 1071 new AudioDebugRecordingsHandler(profile); | 1067 new AudioDebugRecordingsHandler(profile); |
| 1072 host->SetUserData( | 1068 host->SetUserData( |
| 1073 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey, | 1069 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey, |
| 1074 new base::UserDataAdapter<AudioDebugRecordingsHandler>( | 1070 new base::UserDataAdapter<AudioDebugRecordingsHandler>( |
| 1075 audio_debug_recordings_handler)); | 1071 audio_debug_recordings_handler)); |
| 1076 | 1072 |
| 1077 #endif | 1073 #endif |
| 1078 #if !defined(DISABLE_NACL) | 1074 #if !defined(DISABLE_NACL) |
| 1075 net::URLRequestContextGetter* context = |
| 1076 host->GetStoragePartition()->GetURLRequestContext(); |
| 1079 host->AddFilter(new nacl::NaClHostMessageFilter( | 1077 host->AddFilter(new nacl::NaClHostMessageFilter( |
| 1080 id, profile->IsOffTheRecord(), | 1078 id, profile->IsOffTheRecord(), |
| 1081 profile->GetPath(), | 1079 profile->GetPath(), |
| 1082 context)); | 1080 context)); |
| 1083 #endif | 1081 #endif |
| 1084 #if defined(OS_ANDROID) | 1082 #if defined(OS_ANDROID) |
| 1085 host->AddFilter(new cdm::CdmMessageFilterAndroid()); | 1083 host->AddFilter(new cdm::CdmMessageFilterAndroid()); |
| 1086 #endif | 1084 #endif |
| 1087 | 1085 |
| 1088 bool is_incognito_process = profile->IsOffTheRecord(); | 1086 bool is_incognito_process = profile->IsOffTheRecord(); |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2956 registry->AddInterface( | 2954 registry->AddInterface( |
| 2957 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), | 2955 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), |
| 2958 ui_task_runner); | 2956 ui_task_runner); |
| 2959 registry->AddInterface( | 2957 registry->AddInterface( |
| 2960 base::Bind(&FieldTrialRecorder::Create), | 2958 base::Bind(&FieldTrialRecorder::Create), |
| 2961 ui_task_runner); | 2959 ui_task_runner); |
| 2962 registry->AddInterface( | 2960 registry->AddInterface( |
| 2963 base::Bind(&rappor::RapporRecorderImpl::Create, | 2961 base::Bind(&rappor::RapporRecorderImpl::Create, |
| 2964 g_browser_process->rappor_service()), | 2962 g_browser_process->rappor_service()), |
| 2965 ui_task_runner); | 2963 ui_task_runner); |
| 2966 | 2964 if (NetBenchmarking::CheckBenchmarkingEnabled()) { |
| 2965 Profile* profile = |
| 2966 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); |
| 2967 net::URLRequestContextGetter* context = |
| 2968 render_process_host->GetStoragePartition()->GetURLRequestContext(); |
| 2969 registry->AddInterface( |
| 2970 base::Bind(&NetBenchmarking::Create, profile, context)); |
| 2971 } |
| 2967 #if defined(OS_CHROMEOS) | 2972 #if defined(OS_CHROMEOS) |
| 2968 registry->AddInterface<metrics::mojom::LeakDetector>( | 2973 registry->AddInterface<metrics::mojom::LeakDetector>( |
| 2969 base::Bind(&metrics::LeakDetectorRemoteController::Create), | 2974 base::Bind(&metrics::LeakDetectorRemoteController::Create), |
| 2970 ui_task_runner); | 2975 ui_task_runner); |
| 2971 #endif | 2976 #endif |
| 2972 } | 2977 } |
| 2973 | 2978 |
| 2974 void ChromeContentBrowserClient::ExposeInterfacesToMediaService( | 2979 void ChromeContentBrowserClient::ExposeInterfacesToMediaService( |
| 2975 service_manager::InterfaceRegistry* registry, | 2980 service_manager::InterfaceRegistry* registry, |
| 2976 content::RenderFrameHost* render_frame_host) { | 2981 content::RenderFrameHost* render_frame_host) { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3378 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3383 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
| 3379 return variations::GetVariationParamValue( | 3384 return variations::GetVariationParamValue( |
| 3380 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3385 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
| 3381 } | 3386 } |
| 3382 | 3387 |
| 3383 // static | 3388 // static |
| 3384 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3389 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
| 3385 const storage::QuotaSettings* settings) { | 3390 const storage::QuotaSettings* settings) { |
| 3386 g_default_quota_settings = settings; | 3391 g_default_quota_settings = settings; |
| 3387 } | 3392 } |
| OLD | NEW |