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/engagement/site_engagement_eviction_policy.h" | 50 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" |
52 #include "chrome/browser/field_trial_recorder.h" | 51 #include "chrome/browser/field_trial_recorder.h" |
53 #include "chrome/browser/font_family_cache.h" | 52 #include "chrome/browser/font_family_cache.h" |
54 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
55 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" | 54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" |
56 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 55 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
57 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 56 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 57 #include "chrome/browser/net_benchmarking_impl.h" |
58 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 58 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
59 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" | 59 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" |
60 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 60 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
61 #include "chrome/browser/payments/payment_request_impl.h" | 61 #include "chrome/browser/payments/payment_request_impl.h" |
62 #include "chrome/browser/permissions/permission_context_base.h" | 62 #include "chrome/browser/permissions/permission_context_base.h" |
63 #include "chrome/browser/platform_util.h" | 63 #include "chrome/browser/platform_util.h" |
64 #include "chrome/browser/prerender/prerender_final_status.h" | 64 #include "chrome/browser/prerender/prerender_final_status.h" |
65 #include "chrome/browser/prerender/prerender_manager.h" | 65 #include "chrome/browser/prerender/prerender_manager.h" |
66 #include "chrome/browser/prerender/prerender_manager_factory.h" | 66 #include "chrome/browser/prerender/prerender_manager_factory.h" |
67 #include "chrome/browser/prerender/prerender_message_filter.h" | 67 #include "chrome/browser/prerender/prerender_message_filter.h" |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 content::WebContentsViewDelegate* | 1028 content::WebContentsViewDelegate* |
1029 ChromeContentBrowserClient::GetWebContentsViewDelegate( | 1029 ChromeContentBrowserClient::GetWebContentsViewDelegate( |
1030 content::WebContents* web_contents) { | 1030 content::WebContents* web_contents) { |
1031 return chrome::CreateWebContentsViewDelegate(web_contents); | 1031 return chrome::CreateWebContentsViewDelegate(web_contents); |
1032 } | 1032 } |
1033 | 1033 |
1034 void ChromeContentBrowserClient::RenderProcessWillLaunch( | 1034 void ChromeContentBrowserClient::RenderProcessWillLaunch( |
1035 content::RenderProcessHost* host) { | 1035 content::RenderProcessHost* host) { |
1036 int id = host->GetID(); | 1036 int id = host->GetID(); |
1037 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1037 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
1038 net::URLRequestContextGetter* context = | |
1039 host->GetStoragePartition()->GetURLRequestContext(); | |
1040 | |
1041 host->AddFilter(new ChromeRenderMessageFilter( | 1038 host->AddFilter(new ChromeRenderMessageFilter( |
1042 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); | 1039 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); |
1043 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1040 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1044 host->AddFilter(new cast::CastTransportHostFilter); | 1041 host->AddFilter(new cast::CastTransportHostFilter); |
1045 #endif | 1042 #endif |
1046 #if BUILDFLAG(ENABLE_PRINTING) | 1043 #if BUILDFLAG(ENABLE_PRINTING) |
1047 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); | 1044 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); |
1048 #endif | 1045 #endif |
1049 #if BUILDFLAG(ENABLE_SPELLCHECK) | 1046 #if BUILDFLAG(ENABLE_SPELLCHECK) |
1050 host->AddFilter(new SpellCheckMessageFilter(id)); | 1047 host->AddFilter(new SpellCheckMessageFilter(id)); |
1051 #endif | 1048 #endif |
1052 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 1049 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
1053 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); | 1050 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); |
1054 #endif | 1051 #endif |
1055 host->AddFilter(new ChromeNetBenchmarkingMessageFilter(profile, context)); | |
1056 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); | 1052 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); |
1057 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); | 1053 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); |
1058 #if BUILDFLAG(ENABLE_WEBRTC) | 1054 #if BUILDFLAG(ENABLE_WEBRTC) |
1059 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = | 1055 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = |
1060 new WebRtcLoggingHandlerHost(id, profile, | 1056 new WebRtcLoggingHandlerHost(id, profile, |
1061 g_browser_process->webrtc_log_uploader()); | 1057 g_browser_process->webrtc_log_uploader()); |
1062 host->AddFilter(webrtc_logging_handler_host); | 1058 host->AddFilter(webrtc_logging_handler_host); |
1063 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, | 1059 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, |
1064 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( | 1060 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( |
1065 webrtc_logging_handler_host)); | 1061 webrtc_logging_handler_host)); |
1066 | 1062 |
1067 AudioDebugRecordingsHandler* audio_debug_recordings_handler = | 1063 AudioDebugRecordingsHandler* audio_debug_recordings_handler = |
1068 new AudioDebugRecordingsHandler(profile); | 1064 new AudioDebugRecordingsHandler(profile); |
1069 host->SetUserData( | 1065 host->SetUserData( |
1070 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey, | 1066 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey, |
1071 new base::UserDataAdapter<AudioDebugRecordingsHandler>( | 1067 new base::UserDataAdapter<AudioDebugRecordingsHandler>( |
1072 audio_debug_recordings_handler)); | 1068 audio_debug_recordings_handler)); |
1073 | 1069 |
1074 #endif | 1070 #endif |
1075 #if !defined(DISABLE_NACL) | 1071 #if !defined(DISABLE_NACL) |
| 1072 net::URLRequestContextGetter* context = |
| 1073 host->GetStoragePartition()->GetURLRequestContext(); |
1076 host->AddFilter(new nacl::NaClHostMessageFilter( | 1074 host->AddFilter(new nacl::NaClHostMessageFilter( |
1077 id, profile->IsOffTheRecord(), | 1075 id, profile->IsOffTheRecord(), |
1078 profile->GetPath(), | 1076 profile->GetPath(), |
1079 context)); | 1077 context)); |
1080 #endif | 1078 #endif |
1081 #if defined(OS_ANDROID) | 1079 #if defined(OS_ANDROID) |
1082 host->AddFilter(new cdm::CdmMessageFilterAndroid()); | 1080 host->AddFilter(new cdm::CdmMessageFilterAndroid()); |
1083 #endif | 1081 #endif |
1084 | 1082 |
1085 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 1083 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2928 return result == sandbox::SBOX_ALL_OK; | 2926 return result == sandbox::SBOX_ALL_OK; |
2929 } | 2927 } |
2930 #endif // defined(OS_WIN) | 2928 #endif // defined(OS_WIN) |
2931 | 2929 |
2932 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( | 2930 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( |
2933 service_manager::InterfaceRegistry* registry, | 2931 service_manager::InterfaceRegistry* registry, |
2934 content::RenderProcessHost* render_process_host) { | 2932 content::RenderProcessHost* render_process_host) { |
2935 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = | 2933 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = |
2936 content::BrowserThread::GetTaskRunnerForThread( | 2934 content::BrowserThread::GetTaskRunnerForThread( |
2937 content::BrowserThread::UI); | 2935 content::BrowserThread::UI); |
| 2936 Profile* profile = |
| 2937 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); |
| 2938 net::URLRequestContextGetter* context = |
| 2939 render_process_host->GetStoragePartition()->GetURLRequestContext(); |
| 2940 registry->AddInterface( |
| 2941 base::Bind(&NetBenchmarkingImpl::Create, profile, context)); |
2938 registry->AddInterface( | 2942 registry->AddInterface( |
2939 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), | 2943 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), |
2940 ui_task_runner); | 2944 ui_task_runner); |
2941 registry->AddInterface( | 2945 registry->AddInterface( |
2942 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), | 2946 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), |
2943 ui_task_runner); | 2947 ui_task_runner); |
2944 registry->AddInterface( | 2948 registry->AddInterface( |
2945 base::Bind(&FieldTrialRecorder::Create), | 2949 base::Bind(&FieldTrialRecorder::Create), |
2946 ui_task_runner); | 2950 ui_task_runner); |
2947 registry->AddInterface( | 2951 registry->AddInterface( |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 GetBrowserSchedulerWorkerPoolParamsFromVariations(); | 3345 GetBrowserSchedulerWorkerPoolParamsFromVariations(); |
3342 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: | 3346 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: |
3343 BrowserWorkerPoolIndexForTraits); | 3347 BrowserWorkerPoolIndexForTraits); |
3344 } | 3348 } |
3345 | 3349 |
3346 void ChromeContentBrowserClient:: | 3350 void ChromeContentBrowserClient:: |
3347 PerformExperimentalTaskSchedulerRedirections() { | 3351 PerformExperimentalTaskSchedulerRedirections() { |
3348 task_scheduler_util::variations:: | 3352 task_scheduler_util::variations:: |
3349 MaybePerformBrowserTaskSchedulerRedirection(); | 3353 MaybePerformBrowserTaskSchedulerRedirection(); |
3350 } | 3354 } |
OLD | NEW |