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 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/browser_shutdown.h" | 34 #include "chrome/browser/browser_shutdown.h" |
35 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 35 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
36 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 36 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
37 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 37 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
38 #include "chrome/browser/character_encoding.h" | 38 #include "chrome/browser/character_encoding.h" |
39 #include "chrome/browser/chrome_content_browser_client_parts.h" | 39 #include "chrome/browser/chrome_content_browser_client_parts.h" |
40 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | 40 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
41 #include "chrome/browser/chrome_quota_permission_context.h" | 41 #include "chrome/browser/chrome_quota_permission_context.h" |
42 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 42 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
43 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 43 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 44 #include "chrome/browser/content_settings/mixed_content_settings.h" |
| 45 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
44 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 46 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
45 #include "chrome/browser/defaults.h" | 47 #include "chrome/browser/defaults.h" |
46 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" | 48 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" |
47 #include "chrome/browser/download/download_prefs.h" | 49 #include "chrome/browser/download/download_prefs.h" |
48 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" | 50 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" |
49 #include "chrome/browser/font_family_cache.h" | 51 #include "chrome/browser/font_family_cache.h" |
50 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 52 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
| 53 #include "chrome/browser/infobars/infobar_service.h" |
51 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 54 #include "chrome/browser/media/media_capture_devices_dispatcher.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/spdyproxy/data_reduction_proxy_chrome_settings.h" | 57 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
55 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 58 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
56 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 59 #include "chrome/browser/notifications/platform_notification_service_impl.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" |
60 #include "chrome/browser/prerender/prerender_final_status.h" | 63 #include "chrome/browser/prerender/prerender_final_status.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #include "chrome/common/chrome_constants.h" | 101 #include "chrome/common/chrome_constants.h" |
99 #include "chrome/common/chrome_paths.h" | 102 #include "chrome/common/chrome_paths.h" |
100 #include "chrome/common/chrome_switches.h" | 103 #include "chrome/common/chrome_switches.h" |
101 #include "chrome/common/env_vars.h" | 104 #include "chrome/common/env_vars.h" |
102 #include "chrome/common/features.h" | 105 #include "chrome/common/features.h" |
103 #include "chrome/common/logging_chrome.h" | 106 #include "chrome/common/logging_chrome.h" |
104 #include "chrome/common/pepper_permission_util.h" | 107 #include "chrome/common/pepper_permission_util.h" |
105 #include "chrome/common/pref_names.h" | 108 #include "chrome/common/pref_names.h" |
106 #include "chrome/common/render_messages.h" | 109 #include "chrome/common/render_messages.h" |
107 #include "chrome/common/secure_origin_whitelist.h" | 110 #include "chrome/common/secure_origin_whitelist.h" |
| 111 #include "chrome/common/ssl_insecure_content.h" |
108 #include "chrome/common/url_constants.h" | 112 #include "chrome/common/url_constants.h" |
109 #include "chrome/grit/generated_resources.h" | 113 #include "chrome/grit/generated_resources.h" |
110 #include "chrome/installer/util/google_update_settings.h" | 114 #include "chrome/installer/util/google_update_settings.h" |
111 #include "chromeos/chromeos_constants.h" | 115 #include "chromeos/chromeos_constants.h" |
112 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 116 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
113 #include "components/autofill/core/common/autofill_switches.h" | 117 #include "components/autofill/core/common/autofill_switches.h" |
114 #include "components/cdm/browser/cdm_message_filter_android.h" | 118 #include "components/cdm/browser/cdm_message_filter_android.h" |
115 #include "components/cloud_devices/common/cloud_devices_switches.h" | 119 #include "components/cloud_devices/common/cloud_devices_switches.h" |
116 #include "components/content_settings/core/browser/content_settings_utils.h" | 120 #include "components/content_settings/core/browser/content_settings_utils.h" |
117 #include "components/content_settings/core/browser/cookie_settings.h" | 121 #include "components/content_settings/core/browser/cookie_settings.h" |
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3022 Profile* profile = | 3026 Profile* profile = |
3023 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 3027 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
3024 prerender::PrerenderManager* prerender_manager = | 3028 prerender::PrerenderManager* prerender_manager = |
3025 prerender::PrerenderManagerFactory::GetForProfile(profile); | 3029 prerender::PrerenderManagerFactory::GetForProfile(profile); |
3026 if (prerender_manager && | 3030 if (prerender_manager && |
3027 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { | 3031 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { |
3028 *visibility_state = blink::WebPageVisibilityStatePrerender; | 3032 *visibility_state = blink::WebPageVisibilityStatePrerender; |
3029 } | 3033 } |
3030 } | 3034 } |
3031 | 3035 |
| 3036 bool ChromeContentBrowserClient::ShouldAllowDisplayingInsecureContent( |
| 3037 bool allowed_per_settings, |
| 3038 const GURL& resource_url, |
| 3039 content::WebContents* web_contents) { |
| 3040 // Note: this implementation is a mirror of |
| 3041 // ContentSettingsObserver::allowDisplayingInsecureContent |
| 3042 ReportInsecureContent(SslInsecureContentType::DISPLAY); |
| 3043 FilteredReportInsecureContentDisplayed(resource_url); |
| 3044 |
| 3045 MixedContentSettings* mixed_content_settings = |
| 3046 MixedContentSettings::FromWebContents(web_contents); |
| 3047 DCHECK(mixed_content_settings); |
| 3048 if (allowed_per_settings || |
| 3049 mixed_content_settings->insecure_content_allowed_displaying()) { |
| 3050 return true; |
| 3051 } |
| 3052 |
| 3053 InfoBarService* info_bar = InfoBarService::FromWebContents(web_contents); |
| 3054 info_bar->OnDidBlockDisplayingInsecureContent(); |
| 3055 return false; |
| 3056 } |
| 3057 |
| 3058 bool ChromeContentBrowserClient::ShouldAllowRunningInsecureContent( |
| 3059 bool allowed_per_settings, |
| 3060 const url::Origin& origin, |
| 3061 const GURL& resource_url, |
| 3062 content::WebContents* web_contents) { |
| 3063 // Note: this implementation is a mirror of |
| 3064 // ContentSettingsObserver::allowRunningInsecureContent |
| 3065 FilteredReportInsecureContentRan(resource_url); |
| 3066 |
| 3067 MixedContentSettings* mixed_content_settings = |
| 3068 MixedContentSettings::FromWebContents(web_contents); |
| 3069 DCHECK(mixed_content_settings); |
| 3070 if (allowed_per_settings || |
| 3071 mixed_content_settings->insecure_content_allowed_running()) { |
| 3072 return true; |
| 3073 } |
| 3074 |
| 3075 if (!origin.host().empty()) { |
| 3076 TabSpecificContentSettings* tab_settings = |
| 3077 TabSpecificContentSettings::FromWebContents(web_contents); |
| 3078 DCHECK(tab_settings); |
| 3079 tab_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, |
| 3080 base::UTF8ToUTF16(origin.host())); |
| 3081 } |
| 3082 return false; |
| 3083 } |
| 3084 |
3032 #if defined(ENABLE_WEBRTC) | 3085 #if defined(ENABLE_WEBRTC) |
3033 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( | 3086 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( |
3034 base::CommandLine* to_command_line, | 3087 base::CommandLine* to_command_line, |
3035 const base::CommandLine& from_command_line, | 3088 const base::CommandLine& from_command_line, |
3036 version_info::Channel channel) { | 3089 version_info::Channel channel) { |
3037 #if defined(OS_ANDROID) | 3090 #if defined(OS_ANDROID) |
3038 const version_info::Channel kMaxDisableEncryptionChannel = | 3091 const version_info::Channel kMaxDisableEncryptionChannel = |
3039 version_info::Channel::BETA; | 3092 version_info::Channel::BETA; |
3040 #else | 3093 #else |
3041 const version_info::Channel kMaxDisableEncryptionChannel = | 3094 const version_info::Channel kMaxDisableEncryptionChannel = |
3042 version_info::Channel::DEV; | 3095 version_info::Channel::DEV; |
3043 #endif | 3096 #endif |
3044 if (channel <= kMaxDisableEncryptionChannel) { | 3097 if (channel <= kMaxDisableEncryptionChannel) { |
3045 static const char* const kWebRtcDevSwitchNames[] = { | 3098 static const char* const kWebRtcDevSwitchNames[] = { |
3046 switches::kDisableWebRtcEncryption, | 3099 switches::kDisableWebRtcEncryption, |
3047 }; | 3100 }; |
3048 to_command_line->CopySwitchesFrom(from_command_line, | 3101 to_command_line->CopySwitchesFrom(from_command_line, |
3049 kWebRtcDevSwitchNames, | 3102 kWebRtcDevSwitchNames, |
3050 arraysize(kWebRtcDevSwitchNames)); | 3103 arraysize(kWebRtcDevSwitchNames)); |
3051 } | 3104 } |
3052 } | 3105 } |
3053 #endif // defined(ENABLE_WEBRTC) | 3106 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |