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 29 matching lines...) Expand all Loading... |
40 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 40 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.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/chrome_content_browser_client_parts.h" | 42 #include "chrome/browser/chrome_content_browser_client_parts.h" |
43 #include "chrome/browser/chrome_quota_permission_context.h" | 43 #include "chrome/browser/chrome_quota_permission_context.h" |
44 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 44 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
45 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 45 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
46 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 46 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
47 #include "chrome/browser/defaults.h" | 47 #include "chrome/browser/defaults.h" |
48 #include "chrome/browser/download/download_prefs.h" | 48 #include "chrome/browser/download/download_prefs.h" |
49 #include "chrome/browser/font_family_cache.h" | 49 #include "chrome/browser/font_family_cache.h" |
| 50 #include "chrome/browser/media/router/media_router_feature.h" |
| 51 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" |
| 52 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp
l.h" |
50 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
51 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" | 54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" |
52 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 55 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
53 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 56 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
54 #include "chrome/browser/net_benchmarking.h" | 57 #include "chrome/browser/net_benchmarking.h" |
55 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 58 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
56 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle
.h" | 59 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle
.h" |
57 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" | 60 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" |
58 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 61 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
59 #include "chrome/browser/permissions/permission_context_base.h" | 62 #include "chrome/browser/permissions/permission_context_base.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 #include "extensions/common/constants.h" | 343 #include "extensions/common/constants.h" |
341 #include "extensions/common/extension.h" | 344 #include "extensions/common/extension.h" |
342 #include "extensions/common/extension_set.h" | 345 #include "extensions/common/extension_set.h" |
343 #include "extensions/common/manifest_handlers/background_info.h" | 346 #include "extensions/common/manifest_handlers/background_info.h" |
344 #include "extensions/common/manifest_handlers/shared_module_info.h" | 347 #include "extensions/common/manifest_handlers/shared_module_info.h" |
345 #include "extensions/common/permissions/permissions_data.h" | 348 #include "extensions/common/permissions/permissions_data.h" |
346 #include "extensions/common/permissions/socket_permission.h" | 349 #include "extensions/common/permissions/socket_permission.h" |
347 #include "extensions/common/switches.h" | 350 #include "extensions/common/switches.h" |
348 #endif | 351 #endif |
349 | 352 |
350 #if BUILDFLAG(ENABLE_EXTENSIONS) && defined(ENABLE_MEDIA_ROUTER) | 353 #if BUILDFLAG(ENABLE_EXTENSIONS) |
351 #include "chrome/browser/media/cast_transport_host_filter.h" | 354 #include "chrome/browser/media/cast_transport_host_filter.h" |
352 #endif // BUILDFLAG(ENABLE_EXTENSIONS) && defined(ENABLE_MEDIA_ROUTER) | 355 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
353 | 356 |
354 #if BUILDFLAG(ENABLE_PLUGINS) | 357 #if BUILDFLAG(ENABLE_PLUGINS) |
355 #include "chrome/browser/plugins/chrome_content_browser_client_plugins_part.h" | 358 #include "chrome/browser/plugins/chrome_content_browser_client_plugins_part.h" |
356 #include "chrome/browser/plugins/flash_download_interception.h" | 359 #include "chrome/browser/plugins/flash_download_interception.h" |
357 #endif | 360 #endif |
358 | 361 |
359 #if BUILDFLAG(ENABLE_SPELLCHECK) | 362 #if BUILDFLAG(ENABLE_SPELLCHECK) |
360 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 363 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
361 #endif | 364 #endif |
362 | 365 |
363 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 366 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
364 #include "components/spellcheck/browser/spellcheck_message_filter_platform.h" | 367 #include "components/spellcheck/browser/spellcheck_message_filter_platform.h" |
365 #endif | 368 #endif |
366 | 369 |
367 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 370 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
368 #include "chrome/browser/supervised_user/supervised_user_google_auth_navigation_
throttle.h" | 371 #include "chrome/browser/supervised_user/supervised_user_google_auth_navigation_
throttle.h" |
369 #endif | 372 #endif |
370 | 373 |
371 #if BUILDFLAG(ENABLE_WEBRTC) | 374 #if BUILDFLAG(ENABLE_WEBRTC) |
372 #include "chrome/browser/media/audio_debug_recordings_handler.h" | 375 #include "chrome/browser/media/audio_debug_recordings_handler.h" |
373 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" | 376 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" |
374 #endif | 377 #endif |
375 | 378 |
376 #if defined(ENABLE_MEDIA_ROUTER) | 379 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
377 #include "chrome/browser/media/router/media_router_feature.h" | |
378 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" | |
379 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp
l.h" | |
380 #endif // defined(ENABLE_MEDIA_ROUTER) | |
381 | |
382 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && defined(ENABLE_MEDIA_ROUTER) | |
383 #include "chrome/browser/media/cast_remoting_connector.h" | 380 #include "chrome/browser/media/cast_remoting_connector.h" |
384 #endif | 381 #endif |
385 | 382 |
386 #if BUILDFLAG(ENABLE_WAYLAND_SERVER) | 383 #if BUILDFLAG(ENABLE_WAYLAND_SERVER) |
387 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" | 384 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" |
388 #endif | 385 #endif |
389 | 386 |
390 #if defined(ENABLE_MOJO_MEDIA) | 387 #if defined(ENABLE_MOJO_MEDIA) |
391 #include "chrome/browser/media/output_protection_impl.h" | 388 #include "chrome/browser/media/output_protection_impl.h" |
392 #if defined(ENABLE_MOJO_CDM) && defined(OS_ANDROID) | 389 #if defined(ENABLE_MOJO_CDM) && defined(OS_ANDROID) |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 ChromeContentBrowserClient::GetWebContentsViewDelegate( | 1204 ChromeContentBrowserClient::GetWebContentsViewDelegate( |
1208 content::WebContents* web_contents) { | 1205 content::WebContents* web_contents) { |
1209 return chrome::CreateWebContentsViewDelegate(web_contents); | 1206 return chrome::CreateWebContentsViewDelegate(web_contents); |
1210 } | 1207 } |
1211 | 1208 |
1212 void ChromeContentBrowserClient::RenderProcessWillLaunch( | 1209 void ChromeContentBrowserClient::RenderProcessWillLaunch( |
1213 content::RenderProcessHost* host) { | 1210 content::RenderProcessHost* host) { |
1214 int id = host->GetID(); | 1211 int id = host->GetID(); |
1215 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1212 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
1216 host->AddFilter(new ChromeRenderMessageFilter(id, profile)); | 1213 host->AddFilter(new ChromeRenderMessageFilter(id, profile)); |
1217 #if BUILDFLAG(ENABLE_EXTENSIONS) && defined(ENABLE_MEDIA_ROUTER) | 1214 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1218 host->AddFilter(new cast::CastTransportHostFilter); | 1215 host->AddFilter(new cast::CastTransportHostFilter); |
1219 #endif | 1216 #endif |
1220 #if BUILDFLAG(ENABLE_PRINTING) | 1217 #if BUILDFLAG(ENABLE_PRINTING) |
1221 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); | 1218 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); |
1222 #endif | 1219 #endif |
1223 #if BUILDFLAG(ENABLE_SPELLCHECK) | 1220 #if BUILDFLAG(ENABLE_SPELLCHECK) |
1224 host->AddFilter(new SpellCheckMessageFilter(id)); | 1221 host->AddFilter(new SpellCheckMessageFilter(id)); |
1225 #endif | 1222 #endif |
1226 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 1223 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
1227 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); | 1224 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3355 nav_params.user_gesture = params.user_gesture; | 3352 nav_params.user_gesture = params.user_gesture; |
3356 | 3353 |
3357 Navigate(&nav_params); | 3354 Navigate(&nav_params); |
3358 callback.Run(nav_params.target_contents); | 3355 callback.Run(nav_params.target_contents); |
3359 #endif | 3356 #endif |
3360 } | 3357 } |
3361 | 3358 |
3362 content::ControllerPresentationServiceDelegate* | 3359 content::ControllerPresentationServiceDelegate* |
3363 ChromeContentBrowserClient::GetControllerPresentationServiceDelegate( | 3360 ChromeContentBrowserClient::GetControllerPresentationServiceDelegate( |
3364 content::WebContents* web_contents) { | 3361 content::WebContents* web_contents) { |
3365 #if defined(ENABLE_MEDIA_ROUTER) | |
3366 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { | 3362 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { |
3367 return media_router::PresentationServiceDelegateImpl:: | 3363 return media_router::PresentationServiceDelegateImpl:: |
3368 GetOrCreateForWebContents(web_contents); | 3364 GetOrCreateForWebContents(web_contents); |
3369 } | 3365 } |
3370 #endif // defined(ENABLE_MEDIA_ROUTER) | |
3371 return nullptr; | 3366 return nullptr; |
3372 } | 3367 } |
3373 | 3368 |
3374 content::ReceiverPresentationServiceDelegate* | 3369 content::ReceiverPresentationServiceDelegate* |
3375 ChromeContentBrowserClient::GetReceiverPresentationServiceDelegate( | 3370 ChromeContentBrowserClient::GetReceiverPresentationServiceDelegate( |
3376 content::WebContents* web_contents) { | 3371 content::WebContents* web_contents) { |
3377 #if defined(ENABLE_MEDIA_ROUTER) | |
3378 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { | 3372 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { |
3379 // ReceiverPresentationServiceDelegateImpl exists only for WebContents | 3373 // ReceiverPresentationServiceDelegateImpl exists only for WebContents |
3380 // created for offscreen presentations. The WebContents must belong to | 3374 // created for offscreen presentations. The WebContents must belong to |
3381 // an incognito profile. | 3375 // an incognito profile. |
3382 if (auto* impl = media_router::ReceiverPresentationServiceDelegateImpl:: | 3376 if (auto* impl = media_router::ReceiverPresentationServiceDelegateImpl:: |
3383 FromWebContents(web_contents)) { | 3377 FromWebContents(web_contents)) { |
3384 DCHECK(web_contents->GetBrowserContext()->IsOffTheRecord()); | 3378 DCHECK(web_contents->GetBrowserContext()->IsOffTheRecord()); |
3385 return impl; | 3379 return impl; |
3386 } | 3380 } |
3387 } | 3381 } |
3388 #endif // defined(ENABLE_MEDIA_ROUTER) | |
3389 return nullptr; | 3382 return nullptr; |
3390 } | 3383 } |
3391 | 3384 |
3392 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, | 3385 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
3393 const GURL& url) { | 3386 const GURL& url) { |
3394 if (url.is_valid()) { | 3387 if (url.is_valid()) { |
3395 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 3388 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
3396 metric, url); | 3389 metric, url); |
3397 } | 3390 } |
3398 } | 3391 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3601 std::unique_ptr<content::MemoryCoordinatorDelegate> | 3594 std::unique_ptr<content::MemoryCoordinatorDelegate> |
3602 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { | 3595 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { |
3603 return memory::ChromeMemoryCoordinatorDelegate::Create(); | 3596 return memory::ChromeMemoryCoordinatorDelegate::Create(); |
3604 } | 3597 } |
3605 | 3598 |
3606 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3599 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
3607 void ChromeContentBrowserClient::CreateMediaRemoter( | 3600 void ChromeContentBrowserClient::CreateMediaRemoter( |
3608 content::RenderFrameHost* render_frame_host, | 3601 content::RenderFrameHost* render_frame_host, |
3609 media::mojom::RemotingSourcePtr source, | 3602 media::mojom::RemotingSourcePtr source, |
3610 media::mojom::RemoterRequest request) { | 3603 media::mojom::RemoterRequest request) { |
3611 #if defined(ENABLE_MEDIA_ROUTER) | |
3612 CastRemotingConnector::CreateMediaRemoter( | 3604 CastRemotingConnector::CreateMediaRemoter( |
3613 render_frame_host, std::move(source), std::move(request)); | 3605 render_frame_host, std::move(source), std::move(request)); |
3614 #else | |
3615 // Chrome's media remoting implementation depends on the Media Router | |
3616 // infrastructure to identify remote sinks and provide the user interface for | |
3617 // sink selection. In the case where the Media Router is not present, simply | |
3618 // drop the interface request. This will prevent code paths for media remoting | |
3619 // in the renderer process from activating. | |
3620 #endif | |
3621 } | 3606 } |
3622 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3607 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) |
3623 | 3608 |
3624 std::unique_ptr<base::TaskScheduler::InitParams> | 3609 std::unique_ptr<base::TaskScheduler::InitParams> |
3625 ChromeContentBrowserClient::GetTaskSchedulerInitParams() { | 3610 ChromeContentBrowserClient::GetTaskSchedulerInitParams() { |
3626 return task_scheduler_util::GetBrowserTaskSchedulerInitParamsFromVariations(); | 3611 return task_scheduler_util::GetBrowserTaskSchedulerInitParamsFromVariations(); |
3627 } | 3612 } |
3628 | 3613 |
3629 void ChromeContentBrowserClient:: | 3614 void ChromeContentBrowserClient:: |
3630 PerformExperimentalTaskSchedulerRedirections() { | 3615 PerformExperimentalTaskSchedulerRedirections() { |
3631 task_scheduler_util::MaybePerformBrowserTaskSchedulerRedirection(); | 3616 task_scheduler_util::MaybePerformBrowserTaskSchedulerRedirection(); |
3632 } | 3617 } |
3633 | 3618 |
3634 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { | 3619 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { |
3635 return variations::GetVariationParamValue( | 3620 return variations::GetVariationParamValue( |
3636 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; | 3621 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; |
3637 } | 3622 } |
3638 | 3623 |
3639 bool ChromeContentBrowserClient:: | 3624 bool ChromeContentBrowserClient:: |
3640 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3625 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3641 return variations::GetVariationParamValue( | 3626 return variations::GetVariationParamValue( |
3642 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3627 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3643 } | 3628 } |
3644 | 3629 |
3645 // static | 3630 // static |
3646 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3631 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3647 const storage::QuotaSettings* settings) { | 3632 const storage::QuotaSettings* settings) { |
3648 g_default_quota_settings = settings; | 3633 g_default_quota_settings = settings; |
3649 } | 3634 } |
OLD | NEW |