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/chrome_quota_permission_context.h" | 40 #include "chrome/browser/chrome_quota_permission_context.h" |
41 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 41 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
42 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 42 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
43 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 43 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
44 #include "chrome/browser/defaults.h" | 44 #include "chrome/browser/defaults.h" |
45 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" | 45 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" |
46 #include "chrome/browser/download/download_prefs.h" | 46 #include "chrome/browser/download/download_prefs.h" |
47 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" | 47 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" |
48 #include "chrome/browser/font_family_cache.h" | 48 #include "chrome/browser/font_family_cache.h" |
49 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 49 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
| 50 #include "chrome/browser/guest_view/chrome_content_browser_client_guest_view_par
t.h" |
| 51 #include "chrome/browser/guest_view/chrome_guest_view_manager_delegate.h" |
50 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 52 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
51 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 53 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
52 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 54 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
53 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 55 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
54 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 56 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
55 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 57 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
56 #include "chrome/browser/platform_util.h" | 58 #include "chrome/browser/platform_util.h" |
57 #include "chrome/browser/prerender/prerender_final_status.h" | 59 #include "chrome/browser/prerender/prerender_final_status.h" |
58 #include "chrome/browser/prerender/prerender_manager.h" | 60 #include "chrome/browser/prerender/prerender_manager.h" |
59 #include "chrome/browser/prerender/prerender_manager_factory.h" | 61 #include "chrome/browser/prerender/prerender_manager_factory.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 #include "components/cdm/browser/cdm_message_filter_android.h" | 111 #include "components/cdm/browser/cdm_message_filter_android.h" |
110 #include "components/cloud_devices/common/cloud_devices_switches.h" | 112 #include "components/cloud_devices/common/cloud_devices_switches.h" |
111 #include "components/content_settings/core/browser/content_settings_utils.h" | 113 #include "components/content_settings/core/browser/content_settings_utils.h" |
112 #include "components/content_settings/core/browser/cookie_settings.h" | 114 #include "components/content_settings/core/browser/cookie_settings.h" |
113 #include "components/content_settings/core/browser/host_content_settings_map.h" | 115 #include "components/content_settings/core/browser/host_content_settings_map.h" |
114 #include "components/content_settings/core/common/content_settings.h" | 116 #include "components/content_settings/core/common/content_settings.h" |
115 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_m
essage_filter.h" | 117 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_m
essage_filter.h" |
116 #include "components/dom_distiller/core/dom_distiller_switches.h" | 118 #include "components/dom_distiller/core/dom_distiller_switches.h" |
117 #include "components/dom_distiller/core/url_constants.h" | 119 #include "components/dom_distiller/core/url_constants.h" |
118 #include "components/error_page/common/error_page_switches.h" | 120 #include "components/error_page/common/error_page_switches.h" |
| 121 #include "components/framelet/browser/framelet_factory_impl.h" |
119 #include "components/google/core/browser/google_util.h" | 122 #include "components/google/core/browser/google_util.h" |
| 123 #include "components/guest_view/browser/guest_view_base.h" |
| 124 #include "components/guest_view/browser/guest_view_manager.h" |
120 #include "components/metrics/client_info.h" | 125 #include "components/metrics/client_info.h" |
121 #include "components/net_log/chrome_net_log.h" | 126 #include "components/net_log/chrome_net_log.h" |
122 #include "components/pref_registry/pref_registry_syncable.h" | 127 #include "components/pref_registry/pref_registry_syncable.h" |
123 #include "components/rappor/rappor_utils.h" | 128 #include "components/rappor/rappor_utils.h" |
124 #include "components/security_interstitials/core/ssl_error_ui.h" | 129 #include "components/security_interstitials/core/ssl_error_ui.h" |
125 #include "components/signin/core/common/profile_management_switches.h" | 130 #include "components/signin/core/common/profile_management_switches.h" |
126 #include "components/startup_metric_utils/browser/startup_metric_message_filter.
h" | 131 #include "components/startup_metric_utils/browser/startup_metric_message_filter.
h" |
127 #include "components/translate/core/common/translate_switches.h" | 132 #include "components/translate/core/common/translate_switches.h" |
128 #include "components/url_formatter/url_fixer.h" | 133 #include "components/url_formatter/url_fixer.h" |
129 #include "components/variations/variations_associated_data.h" | 134 #include "components/variations/variations_associated_data.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 #include "components/nacl/browser/nacl_process_host.h" | 246 #include "components/nacl/browser/nacl_process_host.h" |
242 #include "components/nacl/common/nacl_process_type.h" | 247 #include "components/nacl/common/nacl_process_type.h" |
243 #include "components/nacl/common/nacl_switches.h" | 248 #include "components/nacl/common/nacl_switches.h" |
244 #endif | 249 #endif |
245 | 250 |
246 #if defined(ENABLE_EXTENSIONS) | 251 #if defined(ENABLE_EXTENSIONS) |
247 #include "chrome/browser/accessibility/animation_policy_prefs.h" | 252 #include "chrome/browser/accessibility/animation_policy_prefs.h" |
248 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" | 253 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
249 #include "chrome/browser/media/cast_transport_host_filter.h" | 254 #include "chrome/browser/media/cast_transport_host_filter.h" |
250 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" | 255 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" |
251 #include "components/guest_view/browser/guest_view_base.h" | |
252 #include "components/guest_view/browser/guest_view_manager.h" | |
253 #include "extensions/browser/extension_registry.h" | 256 #include "extensions/browser/extension_registry.h" |
254 #include "extensions/browser/extension_util.h" | 257 #include "extensions/browser/extension_util.h" |
255 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 258 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
256 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 259 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
257 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 260 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
258 #include "extensions/common/constants.h" | 261 #include "extensions/common/constants.h" |
259 #include "extensions/common/extension.h" | 262 #include "extensions/common/extension.h" |
260 #include "extensions/common/extension_set.h" | 263 #include "extensions/common/extension_set.h" |
261 #include "extensions/common/manifest_handlers/background_info.h" | 264 #include "extensions/common/manifest_handlers/background_info.h" |
262 #include "extensions/common/manifest_handlers/shared_module_info.h" | 265 #include "extensions/common/manifest_handlers/shared_module_info.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 if (minWidth >= kWidthForMaxFSM) | 632 if (minWidth >= kWidthForMaxFSM) |
630 return kMaxFSM; | 633 return kMaxFSM; |
631 | 634 |
632 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. | 635 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. |
633 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / | 636 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / |
634 (kWidthForMaxFSM - kWidthForMinFSM); | 637 (kWidthForMaxFSM - kWidthForMinFSM); |
635 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | 638 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; |
636 } | 639 } |
637 #endif // defined(OS_ANDROID) | 640 #endif // defined(OS_ANDROID) |
638 | 641 |
639 #if defined(ENABLE_EXTENSIONS) | |
640 // By default, JavaScript and images are enabled in guest content. | 642 // By default, JavaScript and images are enabled in guest content. |
641 void GetGuestViewDefaultContentSettingRules( | 643 void GetGuestViewDefaultContentSettingRules( |
642 bool incognito, | 644 bool incognito, |
643 RendererContentSettingRules* rules) { | 645 RendererContentSettingRules* rules) { |
644 rules->image_rules.push_back( | 646 rules->image_rules.push_back( |
645 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 647 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
646 ContentSettingsPattern::Wildcard(), | 648 ContentSettingsPattern::Wildcard(), |
647 CONTENT_SETTING_ALLOW, | 649 CONTENT_SETTING_ALLOW, |
648 std::string(), | 650 std::string(), |
649 incognito)); | 651 incognito)); |
650 | 652 |
651 rules->script_rules.push_back( | 653 rules->script_rules.push_back( |
652 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 654 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
653 ContentSettingsPattern::Wildcard(), | 655 ContentSettingsPattern::Wildcard(), |
654 CONTENT_SETTING_ALLOW, | 656 CONTENT_SETTING_ALLOW, |
655 std::string(), | 657 std::string(), |
656 incognito)); | 658 incognito)); |
657 } | 659 } |
658 #endif // defined(ENABLE_EXTENSIONS) | |
659 | 660 |
660 void CreateUsbDeviceManager( | 661 void CreateUsbDeviceManager( |
661 RenderFrameHost* render_frame_host, | 662 RenderFrameHost* render_frame_host, |
662 mojo::InterfaceRequest<device::usb::DeviceManager> request) { | 663 mojo::InterfaceRequest<device::usb::DeviceManager> request) { |
663 WebContents* web_contents = | 664 WebContents* web_contents = |
664 WebContents::FromRenderFrameHost(render_frame_host); | 665 WebContents::FromRenderFrameHost(render_frame_host); |
665 if (!web_contents) { | 666 if (!web_contents) { |
666 NOTREACHED(); | 667 NOTREACHED(); |
667 return; | 668 return; |
668 } | 669 } |
(...skipping 18 matching lines...) Expand all Loading... |
687 UsbTabHelper::GetOrCreateForWebContents(web_contents); | 688 UsbTabHelper::GetOrCreateForWebContents(web_contents); |
688 tab_helper->CreatePermissionBubble(render_frame_host, std::move(request)); | 689 tab_helper->CreatePermissionBubble(render_frame_host, std::move(request)); |
689 } | 690 } |
690 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 691 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
691 | 692 |
692 } // namespace | 693 } // namespace |
693 | 694 |
694 ChromeContentBrowserClient::ChromeContentBrowserClient() | 695 ChromeContentBrowserClient::ChromeContentBrowserClient() |
695 : | 696 : |
696 weak_factory_(this) { | 697 weak_factory_(this) { |
| 698 extra_parts_.push_back(new chrome::ChromeContentBrowserClientGuestViewPart); |
697 #if defined(ENABLE_PLUGINS) | 699 #if defined(ENABLE_PLUGINS) |
698 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 700 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
699 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 701 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
700 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 702 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
701 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 703 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
702 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 704 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
703 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 705 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
704 | 706 |
705 extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart); | 707 extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart); |
706 #endif | 708 #endif |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 host->AddFilter(new startup_metric_utils::StartupMetricMessageFilter()); | 939 host->AddFilter(new startup_metric_utils::StartupMetricMessageFilter()); |
938 | 940 |
939 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 941 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
940 profile->IsOffTheRecord())); | 942 profile->IsOffTheRecord())); |
941 | 943 |
942 for (size_t i = 0; i < extra_parts_.size(); ++i) | 944 for (size_t i = 0; i < extra_parts_.size(); ++i) |
943 extra_parts_[i]->RenderProcessWillLaunch(host); | 945 extra_parts_[i]->RenderProcessWillLaunch(host); |
944 | 946 |
945 RendererContentSettingRules rules; | 947 RendererContentSettingRules rules; |
946 if (host->IsForGuestsOnly()) { | 948 if (host->IsForGuestsOnly()) { |
947 #if defined(ENABLE_EXTENSIONS) | |
948 GetGuestViewDefaultContentSettingRules(profile->IsOffTheRecord(), &rules); | 949 GetGuestViewDefaultContentSettingRules(profile->IsOffTheRecord(), &rules); |
949 #else | |
950 NOTREACHED(); | |
951 #endif | |
952 } else { | 950 } else { |
953 GetRendererContentSettingRules( | 951 GetRendererContentSettingRules( |
954 HostContentSettingsMapFactory::GetForProfile(profile), &rules); | 952 HostContentSettingsMapFactory::GetForProfile(profile), &rules); |
955 } | 953 } |
956 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 954 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
957 } | 955 } |
958 | 956 |
959 GURL ChromeContentBrowserClient::GetEffectiveURL( | 957 GURL ChromeContentBrowserClient::GetEffectiveURL( |
960 content::BrowserContext* browser_context, const GURL& url) { | 958 content::BrowserContext* browser_context, const GURL& url) { |
961 Profile* profile = Profile::FromBrowserContext(browser_context); | 959 Profile* profile = Profile::FromBrowserContext(browser_context); |
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 } | 2647 } |
2650 | 2648 |
2651 void ChromeContentBrowserClient::RegisterRenderFrameMojoServices( | 2649 void ChromeContentBrowserClient::RegisterRenderFrameMojoServices( |
2652 content::ServiceRegistry* registry, | 2650 content::ServiceRegistry* registry, |
2653 content::RenderFrameHost* render_frame_host) { | 2651 content::RenderFrameHost* render_frame_host) { |
2654 registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host)); | 2652 registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host)); |
2655 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 2653 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
2656 registry->AddService( | 2654 registry->AddService( |
2657 base::Bind(&CreateWebUsbPermissionBubble, render_frame_host)); | 2655 base::Bind(&CreateWebUsbPermissionBubble, render_frame_host)); |
2658 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 2656 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 2657 registry->AddService(base::Bind( |
| 2658 &framelet::FrameletFactoryImpl::CreateService, render_frame_host, |
| 2659 base::Bind(&chrome::ChromeGuestViewManagerDelegate::Create, |
| 2660 render_frame_host->GetSiteInstance()->GetBrowserContext()))); |
2659 } | 2661 } |
2660 | 2662 |
2661 void ChromeContentBrowserClient::RegisterOutOfProcessMojoApplications( | 2663 void ChromeContentBrowserClient::RegisterOutOfProcessMojoApplications( |
2662 OutOfProcessMojoApplicationMap* apps) { | 2664 OutOfProcessMojoApplicationMap* apps) { |
2663 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) | 2665 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) |
2664 apps->insert(std::make_pair(GURL("mojo:media"), | 2666 apps->insert(std::make_pair(GURL("mojo:media"), |
2665 base::ASCIIToUTF16("Media App"))); | 2667 base::ASCIIToUTF16("Media App"))); |
2666 #endif | 2668 #endif |
2667 } | 2669 } |
2668 | 2670 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2824 if (channel <= kMaxDisableEncryptionChannel) { | 2826 if (channel <= kMaxDisableEncryptionChannel) { |
2825 static const char* const kWebRtcDevSwitchNames[] = { | 2827 static const char* const kWebRtcDevSwitchNames[] = { |
2826 switches::kDisableWebRtcEncryption, | 2828 switches::kDisableWebRtcEncryption, |
2827 }; | 2829 }; |
2828 to_command_line->CopySwitchesFrom(from_command_line, | 2830 to_command_line->CopySwitchesFrom(from_command_line, |
2829 kWebRtcDevSwitchNames, | 2831 kWebRtcDevSwitchNames, |
2830 arraysize(kWebRtcDevSwitchNames)); | 2832 arraysize(kWebRtcDevSwitchNames)); |
2831 } | 2833 } |
2832 } | 2834 } |
2833 #endif // defined(ENABLE_WEBRTC) | 2835 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |