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/metrics_navigation_throttle.h" | 59 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" |
57 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 60 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
58 #include "chrome/browser/permissions/permission_context_base.h" | 61 #include "chrome/browser/permissions/permission_context_base.h" |
59 #include "chrome/browser/platform_util.h" | 62 #include "chrome/browser/platform_util.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 #include "extensions/common/constants.h" | 339 #include "extensions/common/constants.h" |
337 #include "extensions/common/extension.h" | 340 #include "extensions/common/extension.h" |
338 #include "extensions/common/extension_set.h" | 341 #include "extensions/common/extension_set.h" |
339 #include "extensions/common/manifest_handlers/background_info.h" | 342 #include "extensions/common/manifest_handlers/background_info.h" |
340 #include "extensions/common/manifest_handlers/shared_module_info.h" | 343 #include "extensions/common/manifest_handlers/shared_module_info.h" |
341 #include "extensions/common/permissions/permissions_data.h" | 344 #include "extensions/common/permissions/permissions_data.h" |
342 #include "extensions/common/permissions/socket_permission.h" | 345 #include "extensions/common/permissions/socket_permission.h" |
343 #include "extensions/common/switches.h" | 346 #include "extensions/common/switches.h" |
344 #endif | 347 #endif |
345 | 348 |
346 #if BUILDFLAG(ENABLE_EXTENSIONS) && defined(ENABLE_MEDIA_ROUTER) | 349 #if BUILDFLAG(ENABLE_EXTENSIONS) |
347 #include "chrome/browser/media/cast_transport_host_filter.h" | 350 #include "chrome/browser/media/cast_transport_host_filter.h" |
348 #endif // BUILDFLAG(ENABLE_EXTENSIONS) && defined(ENABLE_MEDIA_ROUTER) | 351 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
349 | 352 |
350 #if BUILDFLAG(ENABLE_PLUGINS) | 353 #if BUILDFLAG(ENABLE_PLUGINS) |
351 #include "chrome/browser/plugins/chrome_content_browser_client_plugins_part.h" | 354 #include "chrome/browser/plugins/chrome_content_browser_client_plugins_part.h" |
352 #include "chrome/browser/plugins/flash_download_interception.h" | 355 #include "chrome/browser/plugins/flash_download_interception.h" |
353 #endif | 356 #endif |
354 | 357 |
355 #if BUILDFLAG(ENABLE_SPELLCHECK) | 358 #if BUILDFLAG(ENABLE_SPELLCHECK) |
356 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 359 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
357 #endif | 360 #endif |
358 | 361 |
359 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 362 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
360 #include "components/spellcheck/browser/spellcheck_message_filter_platform.h" | 363 #include "components/spellcheck/browser/spellcheck_message_filter_platform.h" |
361 #endif | 364 #endif |
362 | 365 |
363 #if BUILDFLAG(ENABLE_WEBRTC) | 366 #if BUILDFLAG(ENABLE_WEBRTC) |
364 #include "chrome/browser/media/audio_debug_recordings_handler.h" | 367 #include "chrome/browser/media/audio_debug_recordings_handler.h" |
365 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" | 368 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" |
366 #endif | 369 #endif |
367 | 370 |
368 #if defined(ENABLE_MEDIA_ROUTER) | 371 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
369 #include "chrome/browser/media/router/media_router_feature.h" | |
370 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" | |
371 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp
l.h" | |
372 #endif // defined(ENABLE_MEDIA_ROUTER) | |
373 | |
374 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && defined(ENABLE_MEDIA_ROUTER) | |
375 #include "chrome/browser/media/cast_remoting_connector.h" | 372 #include "chrome/browser/media/cast_remoting_connector.h" |
376 #endif | 373 #endif |
377 | 374 |
378 #if BUILDFLAG(ENABLE_WAYLAND_SERVER) | 375 #if BUILDFLAG(ENABLE_WAYLAND_SERVER) |
379 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" | 376 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" |
380 #endif | 377 #endif |
381 | 378 |
382 #if defined(ENABLE_MOJO_MEDIA) | 379 #if defined(ENABLE_MOJO_MEDIA) |
383 #include "chrome/browser/media/output_protection_impl.h" | 380 #include "chrome/browser/media/output_protection_impl.h" |
384 #endif | 381 #endif |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 content::WebContents* web_contents) { | 1153 content::WebContents* web_contents) { |
1157 return chrome::CreateWebContentsViewDelegate(web_contents); | 1154 return chrome::CreateWebContentsViewDelegate(web_contents); |
1158 } | 1155 } |
1159 | 1156 |
1160 void ChromeContentBrowserClient::RenderProcessWillLaunch( | 1157 void ChromeContentBrowserClient::RenderProcessWillLaunch( |
1161 content::RenderProcessHost* host) { | 1158 content::RenderProcessHost* host) { |
1162 int id = host->GetID(); | 1159 int id = host->GetID(); |
1163 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1160 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
1164 host->AddFilter(new ChromeRenderMessageFilter( | 1161 host->AddFilter(new ChromeRenderMessageFilter( |
1165 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); | 1162 id, profile, host->GetStoragePartition()->GetServiceWorkerContext())); |
1166 #if BUILDFLAG(ENABLE_EXTENSIONS) && defined(ENABLE_MEDIA_ROUTER) | 1163 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1167 host->AddFilter(new cast::CastTransportHostFilter); | 1164 host->AddFilter(new cast::CastTransportHostFilter); |
1168 #endif | 1165 #endif |
1169 #if BUILDFLAG(ENABLE_PRINTING) | 1166 #if BUILDFLAG(ENABLE_PRINTING) |
1170 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); | 1167 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); |
1171 #endif | 1168 #endif |
1172 #if BUILDFLAG(ENABLE_SPELLCHECK) | 1169 #if BUILDFLAG(ENABLE_SPELLCHECK) |
1173 host->AddFilter(new SpellCheckMessageFilter(id)); | 1170 host->AddFilter(new SpellCheckMessageFilter(id)); |
1174 #endif | 1171 #endif |
1175 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 1172 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
1176 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); | 1173 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); |
(...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3311 nav_params.user_gesture = params.user_gesture; | 3308 nav_params.user_gesture = params.user_gesture; |
3312 | 3309 |
3313 Navigate(&nav_params); | 3310 Navigate(&nav_params); |
3314 callback.Run(nav_params.target_contents); | 3311 callback.Run(nav_params.target_contents); |
3315 #endif | 3312 #endif |
3316 } | 3313 } |
3317 | 3314 |
3318 content::ControllerPresentationServiceDelegate* | 3315 content::ControllerPresentationServiceDelegate* |
3319 ChromeContentBrowserClient::GetControllerPresentationServiceDelegate( | 3316 ChromeContentBrowserClient::GetControllerPresentationServiceDelegate( |
3320 content::WebContents* web_contents) { | 3317 content::WebContents* web_contents) { |
3321 #if defined(ENABLE_MEDIA_ROUTER) | |
3322 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { | 3318 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { |
3323 return media_router::PresentationServiceDelegateImpl:: | 3319 return media_router::PresentationServiceDelegateImpl:: |
3324 GetOrCreateForWebContents(web_contents); | 3320 GetOrCreateForWebContents(web_contents); |
3325 } | 3321 } |
3326 #endif // defined(ENABLE_MEDIA_ROUTER) | |
3327 return nullptr; | 3322 return nullptr; |
3328 } | 3323 } |
3329 | 3324 |
3330 content::ReceiverPresentationServiceDelegate* | 3325 content::ReceiverPresentationServiceDelegate* |
3331 ChromeContentBrowserClient::GetReceiverPresentationServiceDelegate( | 3326 ChromeContentBrowserClient::GetReceiverPresentationServiceDelegate( |
3332 content::WebContents* web_contents) { | 3327 content::WebContents* web_contents) { |
3333 #if defined(ENABLE_MEDIA_ROUTER) | |
3334 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { | 3328 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { |
3335 // ReceiverPresentationServiceDelegateImpl exists only for WebContents | 3329 // ReceiverPresentationServiceDelegateImpl exists only for WebContents |
3336 // created for offscreen presentations. The WebContents must belong to | 3330 // created for offscreen presentations. The WebContents must belong to |
3337 // an incognito profile. | 3331 // an incognito profile. |
3338 if (auto* impl = media_router::ReceiverPresentationServiceDelegateImpl:: | 3332 if (auto* impl = media_router::ReceiverPresentationServiceDelegateImpl:: |
3339 FromWebContents(web_contents)) { | 3333 FromWebContents(web_contents)) { |
3340 DCHECK(web_contents->GetBrowserContext()->IsOffTheRecord()); | 3334 DCHECK(web_contents->GetBrowserContext()->IsOffTheRecord()); |
3341 return impl; | 3335 return impl; |
3342 } | 3336 } |
3343 } | 3337 } |
3344 #endif // defined(ENABLE_MEDIA_ROUTER) | |
3345 return nullptr; | 3338 return nullptr; |
3346 } | 3339 } |
3347 | 3340 |
3348 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, | 3341 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
3349 const GURL& url) { | 3342 const GURL& url) { |
3350 if (url.is_valid()) { | 3343 if (url.is_valid()) { |
3351 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 3344 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
3352 metric, url); | 3345 metric, url); |
3353 } | 3346 } |
3354 } | 3347 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3515 std::unique_ptr<content::MemoryCoordinatorDelegate> | 3508 std::unique_ptr<content::MemoryCoordinatorDelegate> |
3516 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { | 3509 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { |
3517 return memory::ChromeMemoryCoordinatorDelegate::Create(); | 3510 return memory::ChromeMemoryCoordinatorDelegate::Create(); |
3518 } | 3511 } |
3519 | 3512 |
3520 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3513 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
3521 void ChromeContentBrowserClient::CreateMediaRemoter( | 3514 void ChromeContentBrowserClient::CreateMediaRemoter( |
3522 content::RenderFrameHost* render_frame_host, | 3515 content::RenderFrameHost* render_frame_host, |
3523 media::mojom::RemotingSourcePtr source, | 3516 media::mojom::RemotingSourcePtr source, |
3524 media::mojom::RemoterRequest request) { | 3517 media::mojom::RemoterRequest request) { |
3525 #if defined(ENABLE_MEDIA_ROUTER) | |
3526 CastRemotingConnector::CreateMediaRemoter( | 3518 CastRemotingConnector::CreateMediaRemoter( |
3527 render_frame_host, std::move(source), std::move(request)); | 3519 render_frame_host, std::move(source), std::move(request)); |
3528 #else | |
3529 // Chrome's media remoting implementation depends on the Media Router | |
3530 // infrastructure to identify remote sinks and provide the user interface for | |
3531 // sink selection. In the case where the Media Router is not present, simply | |
3532 // drop the interface request. This will prevent code paths for media remoting | |
3533 // in the renderer process from activating. | |
3534 #endif | |
3535 } | 3520 } |
3536 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3521 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) |
3537 | 3522 |
3538 void ChromeContentBrowserClient::GetTaskSchedulerInitializationParams( | 3523 void ChromeContentBrowserClient::GetTaskSchedulerInitializationParams( |
3539 std::vector<base::SchedulerWorkerPoolParams>* params_vector, | 3524 std::vector<base::SchedulerWorkerPoolParams>* params_vector, |
3540 base::TaskScheduler::WorkerPoolIndexForTraitsCallback* | 3525 base::TaskScheduler::WorkerPoolIndexForTraitsCallback* |
3541 index_to_traits_callback) { | 3526 index_to_traits_callback) { |
3542 DCHECK(params_vector); | 3527 DCHECK(params_vector); |
3543 DCHECK(index_to_traits_callback); | 3528 DCHECK(index_to_traits_callback); |
3544 // If this call fails, content will fall back to the default params. | 3529 // If this call fails, content will fall back to the default params. |
(...skipping 17 matching lines...) Expand all Loading... |
3562 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3547 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3563 return variations::GetVariationParamValue( | 3548 return variations::GetVariationParamValue( |
3564 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3549 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3565 } | 3550 } |
3566 | 3551 |
3567 // static | 3552 // static |
3568 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3553 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3569 const storage::QuotaSettings* settings) { | 3554 const storage::QuotaSettings* settings) { |
3570 g_default_quota_settings = settings; | 3555 g_default_quota_settings = settings; |
3571 } | 3556 } |
OLD | NEW |