Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2521823008: Migrate chrome_net_benchmarking_message_filter to mojo (Closed)
Patch Set: change all calls to use default sync method Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 content::WebContentsViewDelegate* 1029 content::WebContentsViewDelegate*
1030 ChromeContentBrowserClient::GetWebContentsViewDelegate( 1030 ChromeContentBrowserClient::GetWebContentsViewDelegate(
1031 content::WebContents* web_contents) { 1031 content::WebContents* web_contents) {
1032 return chrome::CreateWebContentsViewDelegate(web_contents); 1032 return chrome::CreateWebContentsViewDelegate(web_contents);
1033 } 1033 }
1034 1034
1035 void ChromeContentBrowserClient::RenderProcessWillLaunch( 1035 void ChromeContentBrowserClient::RenderProcessWillLaunch(
1036 content::RenderProcessHost* host) { 1036 content::RenderProcessHost* host) {
1037 int id = host->GetID(); 1037 int id = host->GetID();
1038 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); 1038 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
1039 net::URLRequestContextGetter* context =
1040 host->GetStoragePartition()->GetURLRequestContext();
1041
1042 host->AddFilter(new ChromeRenderMessageFilter( 1039 host->AddFilter(new ChromeRenderMessageFilter(
1043 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); 1040 id, profile, host->GetStoragePartition()->GetServiceWorkerContext()));
1044 #if BUILDFLAG(ENABLE_EXTENSIONS) 1041 #if BUILDFLAG(ENABLE_EXTENSIONS)
1045 host->AddFilter(new cast::CastTransportHostFilter); 1042 host->AddFilter(new cast::CastTransportHostFilter);
1046 #endif 1043 #endif
1047 #if BUILDFLAG(ENABLE_PRINTING) 1044 #if BUILDFLAG(ENABLE_PRINTING)
1048 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); 1045 host->AddFilter(new printing::PrintingMessageFilter(id, profile));
1049 #endif 1046 #endif
1050 #if BUILDFLAG(ENABLE_SPELLCHECK) 1047 #if BUILDFLAG(ENABLE_SPELLCHECK)
1051 host->AddFilter(new SpellCheckMessageFilter(id)); 1048 host->AddFilter(new SpellCheckMessageFilter(id));
1052 #endif 1049 #endif
1053 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) 1050 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER)
1054 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); 1051 host->AddFilter(new SpellCheckMessageFilterPlatform(id));
1055 #endif 1052 #endif
1056 host->AddFilter(new ChromeNetBenchmarkingMessageFilter(profile, context));
1057 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); 1053 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile));
1058 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); 1054 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext()));
1059 #if BUILDFLAG(ENABLE_WEBRTC) 1055 #if BUILDFLAG(ENABLE_WEBRTC)
1060 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = 1056 WebRtcLoggingHandlerHost* webrtc_logging_handler_host =
1061 new WebRtcLoggingHandlerHost(id, profile, 1057 new WebRtcLoggingHandlerHost(id, profile,
1062 g_browser_process->webrtc_log_uploader()); 1058 g_browser_process->webrtc_log_uploader());
1063 host->AddFilter(webrtc_logging_handler_host); 1059 host->AddFilter(webrtc_logging_handler_host);
1064 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, 1060 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey,
1065 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( 1061 new base::UserDataAdapter<WebRtcLoggingHandlerHost>(
1066 webrtc_logging_handler_host)); 1062 webrtc_logging_handler_host));
1067 1063
1068 AudioDebugRecordingsHandler* audio_debug_recordings_handler = 1064 AudioDebugRecordingsHandler* audio_debug_recordings_handler =
1069 new AudioDebugRecordingsHandler(profile); 1065 new AudioDebugRecordingsHandler(profile);
1070 host->SetUserData( 1066 host->SetUserData(
1071 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey, 1067 AudioDebugRecordingsHandler::kAudioDebugRecordingsHandlerKey,
1072 new base::UserDataAdapter<AudioDebugRecordingsHandler>( 1068 new base::UserDataAdapter<AudioDebugRecordingsHandler>(
1073 audio_debug_recordings_handler)); 1069 audio_debug_recordings_handler));
1074 1070
1075 #endif 1071 #endif
1076 #if !defined(DISABLE_NACL) 1072 #if !defined(DISABLE_NACL)
1073 net::URLRequestContextGetter* context =
1074 host->GetStoragePartition()->GetURLRequestContext();
1077 host->AddFilter(new nacl::NaClHostMessageFilter( 1075 host->AddFilter(new nacl::NaClHostMessageFilter(
1078 id, profile->IsOffTheRecord(), 1076 id, profile->IsOffTheRecord(),
1079 profile->GetPath(), 1077 profile->GetPath(),
1080 context)); 1078 context));
1081 #endif 1079 #endif
1082 #if defined(OS_ANDROID) 1080 #if defined(OS_ANDROID)
1083 host->AddFilter(new cdm::CdmMessageFilterAndroid()); 1081 host->AddFilter(new cdm::CdmMessageFilterAndroid());
1084 #endif 1082 #endif
1085 1083
1086 bool is_incognito_process = profile->IsOffTheRecord(); 1084 bool is_incognito_process = profile->IsOffTheRecord();
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 sandbox::ResultCode result = policy->AddRule( 2926 sandbox::ResultCode result = policy->AddRule(
2929 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, 2927 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
2930 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, 2928 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
2931 L"\\\\.\\pipe\\chrome.nacl.*"); 2929 L"\\\\.\\pipe\\chrome.nacl.*");
2932 if (result != sandbox::SBOX_ALL_OK) 2930 if (result != sandbox::SBOX_ALL_OK)
2933 return false; 2931 return false;
2934 return result == sandbox::SBOX_ALL_OK; 2932 return result == sandbox::SBOX_ALL_OK;
2935 } 2933 }
2936 #endif // defined(OS_WIN) 2934 #endif // defined(OS_WIN)
2937 2935
2938 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( 2936 void ChromeContentBrowserClient::ExposeInterfacesToRenderer(
sky 2016/12/13 02:02:52 What thread does this code run on?
dvallet 2016/12/13 05:20:04 BrowserThread::IO
sky 2016/12/13 14:09:59 I didn't think profile lookup is thread safe (line
dvallet 2016/12/13 23:20:06 Sorry, after talking to Sam and Johan this is actu
2939 service_manager::InterfaceRegistry* registry, 2937 service_manager::InterfaceRegistry* registry,
2940 content::RenderProcessHost* render_process_host) { 2938 content::RenderProcessHost* render_process_host) {
2941 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = 2939 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
2942 content::BrowserThread::GetTaskRunnerForThread( 2940 content::BrowserThread::GetTaskRunnerForThread(
2943 content::BrowserThread::UI); 2941 content::BrowserThread::UI);
2942 Profile* profile =
2943 Profile::FromBrowserContext(render_process_host->GetBrowserContext());
2944 net::URLRequestContextGetter* context =
2945 render_process_host->GetStoragePartition()->GetURLRequestContext();
2946 registry->AddInterface(
2947 base::Bind(&NetBenchmarkingImpl::Create, profile, context));
2944 registry->AddInterface( 2948 registry->AddInterface(
2945 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), 2949 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create),
2946 ui_task_runner); 2950 ui_task_runner);
2947 registry->AddInterface( 2951 registry->AddInterface(
2948 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), 2952 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()),
2949 ui_task_runner); 2953 ui_task_runner);
2950 registry->AddInterface( 2954 registry->AddInterface(
2951 base::Bind(&FieldTrialRecorder::Create), 2955 base::Bind(&FieldTrialRecorder::Create),
2952 ui_task_runner); 2956 ui_task_runner);
2953 registry->AddInterface( 2957 registry->AddInterface(
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
3347 GetBrowserSchedulerWorkerPoolParamsFromVariations(); 3351 GetBrowserSchedulerWorkerPoolParamsFromVariations();
3348 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: 3352 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization::
3349 BrowserWorkerPoolIndexForTraits); 3353 BrowserWorkerPoolIndexForTraits);
3350 } 3354 }
3351 3355
3352 void ChromeContentBrowserClient:: 3356 void ChromeContentBrowserClient::
3353 PerformExperimentalTaskSchedulerRedirections() { 3357 PerformExperimentalTaskSchedulerRedirections() {
3354 task_scheduler_util::variations:: 3358 task_scheduler_util::variations::
3355 MaybePerformBrowserTaskSchedulerRedirection(); 3359 MaybePerformBrowserTaskSchedulerRedirection();
3356 } 3360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698