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" | 44 #include "chrome/browser/chrome_net_benchmarking_impl.h" |
45 #include "chrome/browser/chrome_quota_permission_context.h" | 45 #include "chrome/browser/chrome_quota_permission_context.h" |
46 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 46 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
47 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 47 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
48 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 48 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
49 #include "chrome/browser/defaults.h" | 49 #include "chrome/browser/defaults.h" |
50 #include "chrome/browser/download/download_prefs.h" | 50 #include "chrome/browser/download/download_prefs.h" |
51 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" | 51 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" |
52 #include "chrome/browser/font_family_cache.h" | 52 #include "chrome/browser/font_family_cache.h" |
53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" | 54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 content::WebContentsViewDelegate* | 1023 content::WebContentsViewDelegate* |
1024 ChromeContentBrowserClient::GetWebContentsViewDelegate( | 1024 ChromeContentBrowserClient::GetWebContentsViewDelegate( |
1025 content::WebContents* web_contents) { | 1025 content::WebContents* web_contents) { |
1026 return chrome::CreateWebContentsViewDelegate(web_contents); | 1026 return chrome::CreateWebContentsViewDelegate(web_contents); |
1027 } | 1027 } |
1028 | 1028 |
1029 void ChromeContentBrowserClient::RenderProcessWillLaunch( | 1029 void ChromeContentBrowserClient::RenderProcessWillLaunch( |
1030 content::RenderProcessHost* host) { | 1030 content::RenderProcessHost* host) { |
1031 int id = host->GetID(); | 1031 int id = host->GetID(); |
1032 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1032 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
1033 net::URLRequestContextGetter* context = | |
1034 host->GetStoragePartition()->GetURLRequestContext(); | |
1035 | |
1036 host->AddFilter(new ChromeRenderMessageFilter( | 1033 host->AddFilter(new ChromeRenderMessageFilter( |
1037 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); | 1034 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); |
1038 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1035 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1039 host->AddFilter(new cast::CastTransportHostFilter); | 1036 host->AddFilter(new cast::CastTransportHostFilter); |
1040 #endif | 1037 #endif |
1041 #if BUILDFLAG(ENABLE_PRINTING) | 1038 #if BUILDFLAG(ENABLE_PRINTING) |
1042 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); | 1039 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); |
1043 #endif | 1040 #endif |
1044 #if BUILDFLAG(ENABLE_SPELLCHECK) | 1041 #if BUILDFLAG(ENABLE_SPELLCHECK) |
1045 host->AddFilter(new SpellCheckMessageFilter(id)); | 1042 host->AddFilter(new SpellCheckMessageFilter(id)); |
1046 #endif | 1043 #endif |
1047 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 1044 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
1048 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); | 1045 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); |
1049 #endif | 1046 #endif |
1050 host->AddFilter(new ChromeNetBenchmarkingMessageFilter(profile, context)); | |
1051 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); | 1047 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); |
1052 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); | 1048 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); |
1053 #if BUILDFLAG(ENABLE_WEBRTC) | 1049 #if BUILDFLAG(ENABLE_WEBRTC) |
1054 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = | 1050 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = |
1055 new WebRtcLoggingHandlerHost(id, profile, | 1051 new WebRtcLoggingHandlerHost(id, profile, |
1056 g_browser_process->webrtc_log_uploader()); | 1052 g_browser_process->webrtc_log_uploader()); |
1057 host->AddFilter(webrtc_logging_handler_host); | 1053 host->AddFilter(webrtc_logging_handler_host); |
1058 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, | 1054 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, |
1059 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( | 1055 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( |
1060 webrtc_logging_handler_host)); | 1056 webrtc_logging_handler_host)); |
1061 | 1057 |
1062 AudioDebugRecordingsHandler* audio_debug_recordings_handler = | 1058 AudioDebugRecordingsHandler* audio_debug_recordings_handler = |
1063 new AudioDebugRecordingsHandler(profile); | 1059 new AudioDebugRecordingsHandler(profile); |
1064 host->SetUserData( | 1060 host->SetUserData( |
1065 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey, | 1061 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey, |
1066 new base::UserDataAdapter<AudioDebugRecordingsHandler>( | 1062 new base::UserDataAdapter<AudioDebugRecordingsHandler>( |
1067 audio_debug_recordings_handler)); | 1063 audio_debug_recordings_handler)); |
1068 | 1064 |
1069 #endif | 1065 #endif |
1070 #if !defined(DISABLE_NACL) | 1066 #if !defined(DISABLE_NACL) |
| 1067 net::URLRequestContextGetter* context = |
| 1068 host->GetStoragePartition()->GetURLRequestContext(); |
1071 host->AddFilter(new nacl::NaClHostMessageFilter( | 1069 host->AddFilter(new nacl::NaClHostMessageFilter( |
1072 id, profile->IsOffTheRecord(), | 1070 id, profile->IsOffTheRecord(), |
1073 profile->GetPath(), | 1071 profile->GetPath(), |
1074 context)); | 1072 context)); |
1075 #endif | 1073 #endif |
1076 #if defined(OS_ANDROID) | 1074 #if defined(OS_ANDROID) |
1077 host->AddFilter(new cdm::CdmMessageFilterAndroid()); | 1075 host->AddFilter(new cdm::CdmMessageFilterAndroid()); |
1078 #endif | 1076 #endif |
1079 | 1077 |
1080 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 1078 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2922 return result == sandbox::SBOX_ALL_OK; | 2920 return result == sandbox::SBOX_ALL_OK; |
2923 } | 2921 } |
2924 #endif // defined(OS_WIN) | 2922 #endif // defined(OS_WIN) |
2925 | 2923 |
2926 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( | 2924 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( |
2927 service_manager::InterfaceRegistry* registry, | 2925 service_manager::InterfaceRegistry* registry, |
2928 content::RenderProcessHost* render_process_host) { | 2926 content::RenderProcessHost* render_process_host) { |
2929 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = | 2927 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = |
2930 content::BrowserThread::GetTaskRunnerForThread( | 2928 content::BrowserThread::GetTaskRunnerForThread( |
2931 content::BrowserThread::UI); | 2929 content::BrowserThread::UI); |
| 2930 Profile* profile = |
| 2931 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); |
| 2932 net::URLRequestContextGetter* context = |
| 2933 render_process_host->GetStoragePartition()->GetURLRequestContext(); |
| 2934 registry->AddInterface( |
| 2935 base::Bind(&ChromeNetBenchmarkingImpl::Create, profile, context)); |
2932 registry->AddInterface( | 2936 registry->AddInterface( |
2933 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), | 2937 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), |
2934 ui_task_runner); | 2938 ui_task_runner); |
2935 registry->AddInterface( | 2939 registry->AddInterface( |
2936 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), | 2940 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), |
2937 ui_task_runner); | 2941 ui_task_runner); |
2938 registry->AddInterface( | 2942 registry->AddInterface( |
2939 base::Bind(&rappor::RapporRecorderImpl::Create, | 2943 base::Bind(&rappor::RapporRecorderImpl::Create, |
2940 g_browser_process->rappor_service()), | 2944 g_browser_process->rappor_service()), |
2941 ui_task_runner); | 2945 ui_task_runner); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 render_frame_host, std::move(source), std::move(request)); | 3303 render_frame_host, std::move(source), std::move(request)); |
3300 #else | 3304 #else |
3301 // Chrome's media remoting implementation depends on the Media Router | 3305 // Chrome's media remoting implementation depends on the Media Router |
3302 // infrastructure to identify remote sinks and provide the user interface for | 3306 // infrastructure to identify remote sinks and provide the user interface for |
3303 // sink selection. In the case where the Media Router is not present, simply | 3307 // sink selection. In the case where the Media Router is not present, simply |
3304 // drop the interface request. This will prevent code paths for media remoting | 3308 // drop the interface request. This will prevent code paths for media remoting |
3305 // in the renderer process from activating. | 3309 // in the renderer process from activating. |
3306 #endif | 3310 #endif |
3307 } | 3311 } |
3308 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3312 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) |
OLD | NEW |