| 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 bool ChromeContentBrowserClient::MayReuseHost( | 1241 bool ChromeContentBrowserClient::MayReuseHost( |
| 1242 content::RenderProcessHost* process_host) { | 1242 content::RenderProcessHost* process_host) { |
| 1243 // If there is currently a prerender in progress for the host provided, | 1243 // If there is currently a prerender in progress for the host provided, |
| 1244 // it may not be shared. We require prerenders to be by themselves in a | 1244 // it may not be shared. We require prerenders to be by themselves in a |
| 1245 // separate process so that we can monitor their resource usage. | 1245 // separate process so that we can monitor their resource usage. |
| 1246 Profile* profile = Profile::FromBrowserContext( | 1246 Profile* profile = Profile::FromBrowserContext( |
| 1247 process_host->GetBrowserContext()); | 1247 process_host->GetBrowserContext()); |
| 1248 prerender::PrerenderManager* prerender_manager = | 1248 prerender::PrerenderManager* prerender_manager = |
| 1249 prerender::PrerenderManagerFactory::GetForProfile(profile); | 1249 prerender::PrerenderManagerFactory::GetForBrowserContext(profile); |
| 1250 if (prerender_manager && | 1250 if (prerender_manager && |
| 1251 !prerender_manager->MayReuseProcessHost(process_host)) { | 1251 !prerender_manager->MayReuseProcessHost(process_host)) { |
| 1252 return false; | 1252 return false; |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 return true; | 1255 return true; |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( | 1258 bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( |
| 1259 content::BrowserContext* browser_context, const GURL& url) { | 1259 content::BrowserContext* browser_context, const GURL& url) { |
| (...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3139 blink::WebPageVisibilityState* visibility_state) { | 3139 blink::WebPageVisibilityState* visibility_state) { |
| 3140 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 3140 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 3141 | 3141 |
| 3142 WebContents* web_contents = | 3142 WebContents* web_contents = |
| 3143 WebContents::FromRenderFrameHost(render_frame_host); | 3143 WebContents::FromRenderFrameHost(render_frame_host); |
| 3144 DCHECK(web_contents); | 3144 DCHECK(web_contents); |
| 3145 | 3145 |
| 3146 Profile* profile = | 3146 Profile* profile = |
| 3147 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 3147 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 3148 prerender::PrerenderManager* prerender_manager = | 3148 prerender::PrerenderManager* prerender_manager = |
| 3149 prerender::PrerenderManagerFactory::GetForProfile(profile); | 3149 prerender::PrerenderManagerFactory::GetForBrowserContext(profile); |
| 3150 if (prerender_manager && | 3150 if (prerender_manager && |
| 3151 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { | 3151 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { |
| 3152 *visibility_state = blink::WebPageVisibilityStatePrerender; | 3152 *visibility_state = blink::WebPageVisibilityStatePrerender; |
| 3153 } | 3153 } |
| 3154 } | 3154 } |
| 3155 | 3155 |
| 3156 #if defined(ENABLE_WEBRTC) | 3156 #if defined(ENABLE_WEBRTC) |
| 3157 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( | 3157 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( |
| 3158 base::CommandLine* to_command_line, | 3158 base::CommandLine* to_command_line, |
| 3159 const base::CommandLine& from_command_line, | 3159 const base::CommandLine& from_command_line, |
| 3160 version_info::Channel channel) { | 3160 version_info::Channel channel) { |
| 3161 #if defined(OS_ANDROID) | 3161 #if defined(OS_ANDROID) |
| 3162 const version_info::Channel kMaxDisableEncryptionChannel = | 3162 const version_info::Channel kMaxDisableEncryptionChannel = |
| 3163 version_info::Channel::BETA; | 3163 version_info::Channel::BETA; |
| 3164 #else | 3164 #else |
| 3165 const version_info::Channel kMaxDisableEncryptionChannel = | 3165 const version_info::Channel kMaxDisableEncryptionChannel = |
| 3166 version_info::Channel::DEV; | 3166 version_info::Channel::DEV; |
| 3167 #endif | 3167 #endif |
| 3168 if (channel <= kMaxDisableEncryptionChannel) { | 3168 if (channel <= kMaxDisableEncryptionChannel) { |
| 3169 static const char* const kWebRtcDevSwitchNames[] = { | 3169 static const char* const kWebRtcDevSwitchNames[] = { |
| 3170 switches::kDisableWebRtcEncryption, | 3170 switches::kDisableWebRtcEncryption, |
| 3171 }; | 3171 }; |
| 3172 to_command_line->CopySwitchesFrom(from_command_line, | 3172 to_command_line->CopySwitchesFrom(from_command_line, |
| 3173 kWebRtcDevSwitchNames, | 3173 kWebRtcDevSwitchNames, |
| 3174 arraysize(kWebRtcDevSwitchNames)); | 3174 arraysize(kWebRtcDevSwitchNames)); |
| 3175 } | 3175 } |
| 3176 } | 3176 } |
| 3177 #endif // defined(ENABLE_WEBRTC) | 3177 #endif // defined(ENABLE_WEBRTC) |
| OLD | NEW |