| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 #include "content/public/common/service_manager_connection.h" | 172 #include "content/public/common/service_manager_connection.h" |
| 173 #include "content/public/common/service_names.mojom.h" | 173 #include "content/public/common/service_names.mojom.h" |
| 174 #include "content/public/common/url_utils.h" | 174 #include "content/public/common/url_utils.h" |
| 175 #include "content/public/common/web_preferences.h" | 175 #include "content/public/common/web_preferences.h" |
| 176 #include "device/bluetooth/adapter_factory.h" | 176 #include "device/bluetooth/adapter_factory.h" |
| 177 #include "device/bluetooth/public/interfaces/adapter.mojom.h" | 177 #include "device/bluetooth/public/interfaces/adapter.mojom.h" |
| 178 #include "device/usb/public/interfaces/chooser_service.mojom.h" | 178 #include "device/usb/public/interfaces/chooser_service.mojom.h" |
| 179 #include "device/usb/public/interfaces/device_manager.mojom.h" | 179 #include "device/usb/public/interfaces/device_manager.mojom.h" |
| 180 #include "extensions/features/features.h" | 180 #include "extensions/features/features.h" |
| 181 #include "gin/v8_initializer.h" | 181 #include "gin/v8_initializer.h" |
| 182 #include "media/media_features.h" |
| 182 #include "net/base/mime_util.h" | 183 #include "net/base/mime_util.h" |
| 183 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 184 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 184 #include "net/cookies/canonical_cookie.h" | 185 #include "net/cookies/canonical_cookie.h" |
| 185 #include "net/cookies/cookie_options.h" | 186 #include "net/cookies/cookie_options.h" |
| 186 #include "net/ssl/ssl_cert_request_info.h" | 187 #include "net/ssl/ssl_cert_request_info.h" |
| 187 #include "ppapi/features/features.h" | 188 #include "ppapi/features/features.h" |
| 188 #include "ppapi/host/ppapi_host.h" | 189 #include "ppapi/host/ppapi_host.h" |
| 189 #include "printing/features/features.h" | 190 #include "printing/features/features.h" |
| 190 #include "services/image_decoder/public/interfaces/constants.mojom.h" | 191 #include "services/image_decoder/public/interfaces/constants.mojom.h" |
| 191 #include "services/service_manager/public/cpp/interface_provider.h" | 192 #include "services/service_manager/public/cpp/interface_provider.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 #endif | 323 #endif |
| 323 | 324 |
| 324 #if BUILDFLAG(ENABLE_SPELLCHECK) | 325 #if BUILDFLAG(ENABLE_SPELLCHECK) |
| 325 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 326 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
| 326 #endif | 327 #endif |
| 327 | 328 |
| 328 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 329 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 329 #include "components/spellcheck/browser/spellcheck_message_filter_platform.h" | 330 #include "components/spellcheck/browser/spellcheck_message_filter_platform.h" |
| 330 #endif | 331 #endif |
| 331 | 332 |
| 332 #if defined(ENABLE_WEBRTC) | 333 #if BUILDFLAG(ENABLE_WEBRTC) |
| 333 #include "chrome/browser/media/audio_debug_recordings_handler.h" | 334 #include "chrome/browser/media/audio_debug_recordings_handler.h" |
| 334 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" | 335 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" |
| 335 #endif | 336 #endif |
| 336 | 337 |
| 337 #if defined(ENABLE_MEDIA_ROUTER) | 338 #if defined(ENABLE_MEDIA_ROUTER) |
| 338 #include "chrome/browser/media/router/media_router_feature.h" | 339 #include "chrome/browser/media/router/media_router_feature.h" |
| 339 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" | 340 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" |
| 340 #endif // defined(ENABLE_MEDIA_ROUTER) | 341 #endif // defined(ENABLE_MEDIA_ROUTER) |
| 341 | 342 |
| 342 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && defined(ENABLE_MEDIA_ROUTER) | 343 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && defined(ENABLE_MEDIA_ROUTER) |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 #endif | 1043 #endif |
| 1043 #if BUILDFLAG(ENABLE_SPELLCHECK) | 1044 #if BUILDFLAG(ENABLE_SPELLCHECK) |
| 1044 host->AddFilter(new SpellCheckMessageFilter(id)); | 1045 host->AddFilter(new SpellCheckMessageFilter(id)); |
| 1045 #endif | 1046 #endif |
| 1046 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | 1047 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 1047 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); | 1048 host->AddFilter(new SpellCheckMessageFilterPlatform(id)); |
| 1048 #endif | 1049 #endif |
| 1049 host->AddFilter(new ChromeNetBenchmarkingMessageFilter(profile, context)); | 1050 host->AddFilter(new ChromeNetBenchmarkingMessageFilter(profile, context)); |
| 1050 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); | 1051 host->AddFilter(new prerender::PrerenderMessageFilter(id, profile)); |
| 1051 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); | 1052 host->AddFilter(new TtsMessageFilter(host->GetBrowserContext())); |
| 1052 #if defined(ENABLE_WEBRTC) | 1053 #if BUILDFLAG(ENABLE_WEBRTC) |
| 1053 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = | 1054 WebRtcLoggingHandlerHost* webrtc_logging_handler_host = |
| 1054 new WebRtcLoggingHandlerHost(id, profile, | 1055 new WebRtcLoggingHandlerHost(id, profile, |
| 1055 g_browser_process->webrtc_log_uploader()); | 1056 g_browser_process->webrtc_log_uploader()); |
| 1056 host->AddFilter(webrtc_logging_handler_host); | 1057 host->AddFilter(webrtc_logging_handler_host); |
| 1057 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, | 1058 host->SetUserData(WebRtcLoggingHandlerHost::kWebRtcLoggingHandlerHostKey, |
| 1058 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( | 1059 new base::UserDataAdapter<WebRtcLoggingHandlerHost>( |
| 1059 webrtc_logging_handler_host)); | 1060 webrtc_logging_handler_host)); |
| 1060 | 1061 |
| 1061 AudioDebugRecordingsHandler* audio_debug_recordings_handler = | 1062 AudioDebugRecordingsHandler* audio_debug_recordings_handler = |
| 1062 new AudioDebugRecordingsHandler(profile); | 1063 new AudioDebugRecordingsHandler(profile); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 | 1600 |
| 1600 #if defined(OS_CHROMEOS) | 1601 #if defined(OS_CHROMEOS) |
| 1601 const std::string& login_profile = | 1602 const std::string& login_profile = |
| 1602 browser_command_line.GetSwitchValueASCII( | 1603 browser_command_line.GetSwitchValueASCII( |
| 1603 chromeos::switches::kLoginProfile); | 1604 chromeos::switches::kLoginProfile); |
| 1604 if (!login_profile.empty()) | 1605 if (!login_profile.empty()) |
| 1605 command_line->AppendSwitchASCII( | 1606 command_line->AppendSwitchASCII( |
| 1606 chromeos::switches::kLoginProfile, login_profile); | 1607 chromeos::switches::kLoginProfile, login_profile); |
| 1607 #endif | 1608 #endif |
| 1608 | 1609 |
| 1609 #if defined(ENABLE_WEBRTC) | 1610 #if BUILDFLAG(ENABLE_WEBRTC) |
| 1610 MaybeCopyDisableWebRtcEncryptionSwitch(command_line, | 1611 MaybeCopyDisableWebRtcEncryptionSwitch(command_line, |
| 1611 browser_command_line, | 1612 browser_command_line, |
| 1612 chrome::GetChannel()); | 1613 chrome::GetChannel()); |
| 1613 #endif | 1614 #endif |
| 1614 | 1615 |
| 1615 if (process) { | 1616 if (process) { |
| 1616 PrefService* prefs = profile->GetPrefs(); | 1617 PrefService* prefs = profile->GetPrefs(); |
| 1617 // Currently this pref is only registered if applied via a policy. | 1618 // Currently this pref is only registered if applied via a policy. |
| 1618 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && | 1619 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && |
| 1619 prefs->GetBoolean(prefs::kDisable3DAPIs)) { | 1620 prefs->GetBoolean(prefs::kDisable3DAPIs)) { |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 for (i = render_frames.begin(); i != render_frames.end(); ++i) { | 2065 for (i = render_frames.begin(); i != render_frames.end(); ++i) { |
| 2065 BrowserThread::PostTask( | 2066 BrowserThread::PostTask( |
| 2066 BrowserThread::UI, FROM_HERE, | 2067 BrowserThread::UI, FROM_HERE, |
| 2067 base::Bind(&TabSpecificContentSettings::IndexedDBAccessed, | 2068 base::Bind(&TabSpecificContentSettings::IndexedDBAccessed, |
| 2068 i->first, i->second, url, name, !allow)); | 2069 i->first, i->second, url, name, !allow)); |
| 2069 } | 2070 } |
| 2070 | 2071 |
| 2071 return allow; | 2072 return allow; |
| 2072 } | 2073 } |
| 2073 | 2074 |
| 2074 #if defined(ENABLE_WEBRTC) | 2075 #if BUILDFLAG(ENABLE_WEBRTC) |
| 2075 bool ChromeContentBrowserClient::AllowWebRTCIdentityCache( | 2076 bool ChromeContentBrowserClient::AllowWebRTCIdentityCache( |
| 2076 const GURL& url, | 2077 const GURL& url, |
| 2077 const GURL& first_party_url, | 2078 const GURL& first_party_url, |
| 2078 content::ResourceContext* context) { | 2079 content::ResourceContext* context) { |
| 2079 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 2080 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 2080 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 2081 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
| 2081 content_settings::CookieSettings* cookie_settings = | 2082 content_settings::CookieSettings* cookie_settings = |
| 2082 io_data->GetCookieSettings(); | 2083 io_data->GetCookieSettings(); |
| 2083 return cookie_settings->IsReadingCookieAllowed(url, first_party_url) && | 2084 return cookie_settings->IsReadingCookieAllowed(url, first_party_url) && |
| 2084 cookie_settings->IsSettingCookieAllowed(url, first_party_url); | 2085 cookie_settings->IsSettingCookieAllowed(url, first_party_url); |
| 2085 } | 2086 } |
| 2086 #endif // defined(ENABLE_WEBRTC) | 2087 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 2087 | 2088 |
| 2088 bool ChromeContentBrowserClient::AllowKeygen( | 2089 bool ChromeContentBrowserClient::AllowKeygen( |
| 2089 const GURL& url, | 2090 const GURL& url, |
| 2090 content::ResourceContext* context) { | 2091 content::ResourceContext* context) { |
| 2091 HostContentSettingsMap* content_settings = | 2092 HostContentSettingsMap* content_settings = |
| 2092 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); | 2093 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); |
| 2093 | 2094 |
| 2094 return content_settings->GetContentSetting( | 2095 return content_settings->GetContentSetting( |
| 2095 url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()) == | 2096 url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()) == |
| 2096 CONTENT_SETTING_ALLOW; | 2097 CONTENT_SETTING_ALLOW; |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3252 | 3253 |
| 3253 prerender::PrerenderManager* prerender_manager = | 3254 prerender::PrerenderManager* prerender_manager = |
| 3254 prerender::PrerenderManagerFactory::GetForBrowserContext( | 3255 prerender::PrerenderManagerFactory::GetForBrowserContext( |
| 3255 web_contents->GetBrowserContext()); | 3256 web_contents->GetBrowserContext()); |
| 3256 if (prerender_manager && | 3257 if (prerender_manager && |
| 3257 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { | 3258 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { |
| 3258 *visibility_state = blink::WebPageVisibilityStatePrerender; | 3259 *visibility_state = blink::WebPageVisibilityStatePrerender; |
| 3259 } | 3260 } |
| 3260 } | 3261 } |
| 3261 | 3262 |
| 3262 #if defined(ENABLE_WEBRTC) | 3263 #if BUILDFLAG(ENABLE_WEBRTC) |
| 3263 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( | 3264 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( |
| 3264 base::CommandLine* to_command_line, | 3265 base::CommandLine* to_command_line, |
| 3265 const base::CommandLine& from_command_line, | 3266 const base::CommandLine& from_command_line, |
| 3266 version_info::Channel channel) { | 3267 version_info::Channel channel) { |
| 3267 #if defined(OS_ANDROID) | 3268 #if defined(OS_ANDROID) |
| 3268 const version_info::Channel kMaxDisableEncryptionChannel = | 3269 const version_info::Channel kMaxDisableEncryptionChannel = |
| 3269 version_info::Channel::BETA; | 3270 version_info::Channel::BETA; |
| 3270 #else | 3271 #else |
| 3271 const version_info::Channel kMaxDisableEncryptionChannel = | 3272 const version_info::Channel kMaxDisableEncryptionChannel = |
| 3272 version_info::Channel::DEV; | 3273 version_info::Channel::DEV; |
| 3273 #endif | 3274 #endif |
| 3274 if (channel <= kMaxDisableEncryptionChannel) { | 3275 if (channel <= kMaxDisableEncryptionChannel) { |
| 3275 static const char* const kWebRtcDevSwitchNames[] = { | 3276 static const char* const kWebRtcDevSwitchNames[] = { |
| 3276 switches::kDisableWebRtcEncryption, | 3277 switches::kDisableWebRtcEncryption, |
| 3277 }; | 3278 }; |
| 3278 to_command_line->CopySwitchesFrom(from_command_line, | 3279 to_command_line->CopySwitchesFrom(from_command_line, |
| 3279 kWebRtcDevSwitchNames, | 3280 kWebRtcDevSwitchNames, |
| 3280 arraysize(kWebRtcDevSwitchNames)); | 3281 arraysize(kWebRtcDevSwitchNames)); |
| 3281 } | 3282 } |
| 3282 } | 3283 } |
| 3283 #endif // defined(ENABLE_WEBRTC) | 3284 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 3284 | 3285 |
| 3285 std::unique_ptr<content::MemoryCoordinatorDelegate> | 3286 std::unique_ptr<content::MemoryCoordinatorDelegate> |
| 3286 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { | 3287 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { |
| 3287 return memory::ChromeMemoryCoordinatorDelegate::Create(); | 3288 return memory::ChromeMemoryCoordinatorDelegate::Create(); |
| 3288 } | 3289 } |
| 3289 | 3290 |
| 3290 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3291 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
| 3291 void ChromeContentBrowserClient::CreateMediaRemoter( | 3292 void ChromeContentBrowserClient::CreateMediaRemoter( |
| 3292 content::RenderFrameHost* render_frame_host, | 3293 content::RenderFrameHost* render_frame_host, |
| 3293 media::mojom::RemotingSourcePtr source, | 3294 media::mojom::RemotingSourcePtr source, |
| 3294 media::mojom::RemoterRequest request) { | 3295 media::mojom::RemoterRequest request) { |
| 3295 #if defined(ENABLE_MEDIA_ROUTER) | 3296 #if defined(ENABLE_MEDIA_ROUTER) |
| 3296 CastRemotingConnector::CreateMediaRemoter( | 3297 CastRemotingConnector::CreateMediaRemoter( |
| 3297 render_frame_host, std::move(source), std::move(request)); | 3298 render_frame_host, std::move(source), std::move(request)); |
| 3298 #else | 3299 #else |
| 3299 // Chrome's media remoting implementation depends on the Media Router | 3300 // Chrome's media remoting implementation depends on the Media Router |
| 3300 // infrastructure to identify remote sinks and provide the user interface for | 3301 // infrastructure to identify remote sinks and provide the user interface for |
| 3301 // sink selection. In the case where the Media Router is not present, simply | 3302 // sink selection. In the case where the Media Router is not present, simply |
| 3302 // drop the interface request. This will prevent code paths for media remoting | 3303 // drop the interface request. This will prevent code paths for media remoting |
| 3303 // in the renderer process from activating. | 3304 // in the renderer process from activating. |
| 3304 #endif | 3305 #endif |
| 3305 } | 3306 } |
| 3306 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3307 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) |
| OLD | NEW |