| 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" |
| 50 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 51 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 51 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 52 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 52 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 53 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 53 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 54 #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" | 55 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
| 55 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 56 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 56 #include "chrome/browser/platform_util.h" | 57 #include "chrome/browser/platform_util.h" |
| 57 #include "chrome/browser/prerender/prerender_final_status.h" | 58 #include "chrome/browser/prerender/prerender_final_status.h" |
| 58 #include "chrome/browser/prerender/prerender_manager.h" | 59 #include "chrome/browser/prerender/prerender_manager.h" |
| 59 #include "chrome/browser/prerender/prerender_manager_factory.h" | 60 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #include "components/cloud_devices/common/cloud_devices_switches.h" | 111 #include "components/cloud_devices/common/cloud_devices_switches.h" |
| 111 #include "components/content_settings/core/browser/content_settings_utils.h" | 112 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 112 #include "components/content_settings/core/browser/cookie_settings.h" | 113 #include "components/content_settings/core/browser/cookie_settings.h" |
| 113 #include "components/content_settings/core/browser/host_content_settings_map.h" | 114 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 114 #include "components/content_settings/core/common/content_settings.h" | 115 #include "components/content_settings/core/common/content_settings.h" |
| 115 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_m
essage_filter.h" | 116 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_m
essage_filter.h" |
| 116 #include "components/dom_distiller/core/dom_distiller_switches.h" | 117 #include "components/dom_distiller/core/dom_distiller_switches.h" |
| 117 #include "components/dom_distiller/core/url_constants.h" | 118 #include "components/dom_distiller/core/url_constants.h" |
| 118 #include "components/error_page/common/error_page_switches.h" | 119 #include "components/error_page/common/error_page_switches.h" |
| 119 #include "components/google/core/browser/google_util.h" | 120 #include "components/google/core/browser/google_util.h" |
| 121 #include "components/guest_view/browser/guest_view_base.h" |
| 122 #include "components/guest_view/browser/guest_view_manager.h" |
| 120 #include "components/metrics/client_info.h" | 123 #include "components/metrics/client_info.h" |
| 121 #include "components/net_log/chrome_net_log.h" | 124 #include "components/net_log/chrome_net_log.h" |
| 122 #include "components/pref_registry/pref_registry_syncable.h" | 125 #include "components/pref_registry/pref_registry_syncable.h" |
| 123 #include "components/rappor/rappor_utils.h" | 126 #include "components/rappor/rappor_utils.h" |
| 124 #include "components/security_interstitials/core/ssl_error_ui.h" | 127 #include "components/security_interstitials/core/ssl_error_ui.h" |
| 125 #include "components/signin/core/common/profile_management_switches.h" | 128 #include "components/signin/core/common/profile_management_switches.h" |
| 126 #include "components/startup_metric_utils/browser/startup_metric_message_filter.
h" | 129 #include "components/startup_metric_utils/browser/startup_metric_message_filter.
h" |
| 127 #include "components/translate/core/common/translate_switches.h" | 130 #include "components/translate/core/common/translate_switches.h" |
| 128 #include "components/url_formatter/url_fixer.h" | 131 #include "components/url_formatter/url_fixer.h" |
| 129 #include "components/variations/variations_associated_data.h" | 132 #include "components/variations/variations_associated_data.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 #include "components/nacl/browser/nacl_process_host.h" | 243 #include "components/nacl/browser/nacl_process_host.h" |
| 241 #include "components/nacl/common/nacl_process_type.h" | 244 #include "components/nacl/common/nacl_process_type.h" |
| 242 #include "components/nacl/common/nacl_switches.h" | 245 #include "components/nacl/common/nacl_switches.h" |
| 243 #endif | 246 #endif |
| 244 | 247 |
| 245 #if defined(ENABLE_EXTENSIONS) | 248 #if defined(ENABLE_EXTENSIONS) |
| 246 #include "chrome/browser/accessibility/animation_policy_prefs.h" | 249 #include "chrome/browser/accessibility/animation_policy_prefs.h" |
| 247 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" | 250 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
| 248 #include "chrome/browser/media/cast_transport_host_filter.h" | 251 #include "chrome/browser/media/cast_transport_host_filter.h" |
| 249 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" | 252 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" |
| 250 #include "components/guest_view/browser/guest_view_base.h" | |
| 251 #include "components/guest_view/browser/guest_view_manager.h" | |
| 252 #include "extensions/browser/extension_registry.h" | 253 #include "extensions/browser/extension_registry.h" |
| 253 #include "extensions/browser/extension_util.h" | 254 #include "extensions/browser/extension_util.h" |
| 254 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 255 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 255 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 256 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
| 256 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 257 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
| 257 #include "extensions/common/constants.h" | 258 #include "extensions/common/constants.h" |
| 258 #include "extensions/common/extension.h" | 259 #include "extensions/common/extension.h" |
| 259 #include "extensions/common/extension_set.h" | 260 #include "extensions/common/extension_set.h" |
| 260 #include "extensions/common/manifest_handlers/background_info.h" | 261 #include "extensions/common/manifest_handlers/background_info.h" |
| 261 #include "extensions/common/manifest_handlers/shared_module_info.h" | 262 #include "extensions/common/manifest_handlers/shared_module_info.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 if (minWidth >= kWidthForMaxFSM) | 627 if (minWidth >= kWidthForMaxFSM) |
| 627 return kMaxFSM; | 628 return kMaxFSM; |
| 628 | 629 |
| 629 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. | 630 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. |
| 630 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / | 631 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / |
| 631 (kWidthForMaxFSM - kWidthForMinFSM); | 632 (kWidthForMaxFSM - kWidthForMinFSM); |
| 632 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | 633 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; |
| 633 } | 634 } |
| 634 #endif // defined(OS_ANDROID) | 635 #endif // defined(OS_ANDROID) |
| 635 | 636 |
| 636 #if defined(ENABLE_EXTENSIONS) | |
| 637 // By default, JavaScript and images are enabled in guest content. | 637 // By default, JavaScript and images are enabled in guest content. |
| 638 void GetGuestViewDefaultContentSettingRules( | 638 void GetGuestViewDefaultContentSettingRules( |
| 639 bool incognito, | 639 bool incognito, |
| 640 RendererContentSettingRules* rules) { | 640 RendererContentSettingRules* rules) { |
| 641 rules->image_rules.push_back( | 641 rules->image_rules.push_back( |
| 642 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 642 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
| 643 ContentSettingsPattern::Wildcard(), | 643 ContentSettingsPattern::Wildcard(), |
| 644 CONTENT_SETTING_ALLOW, | 644 CONTENT_SETTING_ALLOW, |
| 645 std::string(), | 645 std::string(), |
| 646 incognito)); | 646 incognito)); |
| 647 | 647 |
| 648 rules->script_rules.push_back( | 648 rules->script_rules.push_back( |
| 649 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 649 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
| 650 ContentSettingsPattern::Wildcard(), | 650 ContentSettingsPattern::Wildcard(), |
| 651 CONTENT_SETTING_ALLOW, | 651 CONTENT_SETTING_ALLOW, |
| 652 std::string(), | 652 std::string(), |
| 653 incognito)); | 653 incognito)); |
| 654 } | 654 } |
| 655 #endif // defined(ENABLE_EXTENSIONS) | |
| 656 | 655 |
| 657 void CreateUsbDeviceManager( | 656 void CreateUsbDeviceManager( |
| 658 RenderFrameHost* render_frame_host, | 657 RenderFrameHost* render_frame_host, |
| 659 mojo::InterfaceRequest<device::usb::DeviceManager> request) { | 658 mojo::InterfaceRequest<device::usb::DeviceManager> request) { |
| 660 WebContents* web_contents = | 659 WebContents* web_contents = |
| 661 WebContents::FromRenderFrameHost(render_frame_host); | 660 WebContents::FromRenderFrameHost(render_frame_host); |
| 662 if (!web_contents) { | 661 if (!web_contents) { |
| 663 NOTREACHED(); | 662 NOTREACHED(); |
| 664 return; | 663 return; |
| 665 } | 664 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 684 UsbTabHelper::GetOrCreateForWebContents(web_contents); | 683 UsbTabHelper::GetOrCreateForWebContents(web_contents); |
| 685 tab_helper->CreatePermissionBubble(render_frame_host, std::move(request)); | 684 tab_helper->CreatePermissionBubble(render_frame_host, std::move(request)); |
| 686 } | 685 } |
| 687 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 686 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 688 | 687 |
| 689 } // namespace | 688 } // namespace |
| 690 | 689 |
| 691 ChromeContentBrowserClient::ChromeContentBrowserClient() | 690 ChromeContentBrowserClient::ChromeContentBrowserClient() |
| 692 : | 691 : |
| 693 weak_factory_(this) { | 692 weak_factory_(this) { |
| 693 extra_parts_.push_back(new chrome::ChromeContentBrowserClientGuestViewPart); |
| 694 #if defined(ENABLE_PLUGINS) | 694 #if defined(ENABLE_PLUGINS) |
| 695 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 695 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
| 696 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 696 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
| 697 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 697 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
| 698 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 698 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
| 699 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 699 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
| 700 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 700 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
| 701 | 701 |
| 702 extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart); | 702 extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart); |
| 703 #endif | 703 #endif |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 host->AddFilter(new startup_metric_utils::StartupMetricMessageFilter()); | 934 host->AddFilter(new startup_metric_utils::StartupMetricMessageFilter()); |
| 935 | 935 |
| 936 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 936 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
| 937 profile->IsOffTheRecord())); | 937 profile->IsOffTheRecord())); |
| 938 | 938 |
| 939 for (size_t i = 0; i < extra_parts_.size(); ++i) | 939 for (size_t i = 0; i < extra_parts_.size(); ++i) |
| 940 extra_parts_[i]->RenderProcessWillLaunch(host); | 940 extra_parts_[i]->RenderProcessWillLaunch(host); |
| 941 | 941 |
| 942 RendererContentSettingRules rules; | 942 RendererContentSettingRules rules; |
| 943 if (host->IsForGuestsOnly()) { | 943 if (host->IsForGuestsOnly()) { |
| 944 #if defined(ENABLE_EXTENSIONS) | |
| 945 GetGuestViewDefaultContentSettingRules(profile->IsOffTheRecord(), &rules); | 944 GetGuestViewDefaultContentSettingRules(profile->IsOffTheRecord(), &rules); |
| 946 #else | |
| 947 NOTREACHED(); | |
| 948 #endif | |
| 949 } else { | 945 } else { |
| 950 GetRendererContentSettingRules( | 946 GetRendererContentSettingRules( |
| 951 HostContentSettingsMapFactory::GetForProfile(profile), &rules); | 947 HostContentSettingsMapFactory::GetForProfile(profile), &rules); |
| 952 } | 948 } |
| 953 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 949 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
| 954 } | 950 } |
| 955 | 951 |
| 956 GURL ChromeContentBrowserClient::GetEffectiveURL( | 952 GURL ChromeContentBrowserClient::GetEffectiveURL( |
| 957 content::BrowserContext* browser_context, const GURL& url) { | 953 content::BrowserContext* browser_context, const GURL& url) { |
| 958 Profile* profile = Profile::FromBrowserContext(browser_context); | 954 Profile* profile = Profile::FromBrowserContext(browser_context); |
| (...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2818 if (channel <= kMaxDisableEncryptionChannel) { | 2814 if (channel <= kMaxDisableEncryptionChannel) { |
| 2819 static const char* const kWebRtcDevSwitchNames[] = { | 2815 static const char* const kWebRtcDevSwitchNames[] = { |
| 2820 switches::kDisableWebRtcEncryption, | 2816 switches::kDisableWebRtcEncryption, |
| 2821 }; | 2817 }; |
| 2822 to_command_line->CopySwitchesFrom(from_command_line, | 2818 to_command_line->CopySwitchesFrom(from_command_line, |
| 2823 kWebRtcDevSwitchNames, | 2819 kWebRtcDevSwitchNames, |
| 2824 arraysize(kWebRtcDevSwitchNames)); | 2820 arraysize(kWebRtcDevSwitchNames)); |
| 2825 } | 2821 } |
| 2826 } | 2822 } |
| 2827 #endif // defined(ENABLE_WEBRTC) | 2823 #endif // defined(ENABLE_WEBRTC) |
| OLD | NEW |