| 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 #else | 1236 #else |
| 1237 return true; | 1237 return true; |
| 1238 #endif | 1238 #endif |
| 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( | |
| 1247 process_host->GetBrowserContext()); | |
| 1248 prerender::PrerenderManager* prerender_manager = | 1246 prerender::PrerenderManager* prerender_manager = |
| 1249 prerender::PrerenderManagerFactory::GetForProfile(profile); | 1247 prerender::PrerenderManagerFactory::GetForBrowserContext( |
| 1248 process_host->GetBrowserContext()); |
| 1250 if (prerender_manager && | 1249 if (prerender_manager && |
| 1251 !prerender_manager->MayReuseProcessHost(process_host)) { | 1250 !prerender_manager->MayReuseProcessHost(process_host)) { |
| 1252 return false; | 1251 return false; |
| 1253 } | 1252 } |
| 1254 | 1253 |
| 1255 return true; | 1254 return true; |
| 1256 } | 1255 } |
| 1257 | 1256 |
| 1258 bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( | 1257 bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( |
| 1259 content::BrowserContext* browser_context, const GURL& url) { | 1258 content::BrowserContext* browser_context, const GURL& url) { |
| (...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3136 | 3135 |
| 3137 void ChromeContentBrowserClient::OverridePageVisibilityState( | 3136 void ChromeContentBrowserClient::OverridePageVisibilityState( |
| 3138 RenderFrameHost* render_frame_host, | 3137 RenderFrameHost* render_frame_host, |
| 3139 blink::WebPageVisibilityState* visibility_state) { | 3138 blink::WebPageVisibilityState* visibility_state) { |
| 3140 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 3139 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 3141 | 3140 |
| 3142 WebContents* web_contents = | 3141 WebContents* web_contents = |
| 3143 WebContents::FromRenderFrameHost(render_frame_host); | 3142 WebContents::FromRenderFrameHost(render_frame_host); |
| 3144 DCHECK(web_contents); | 3143 DCHECK(web_contents); |
| 3145 | 3144 |
| 3146 Profile* profile = | |
| 3147 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | |
| 3148 prerender::PrerenderManager* prerender_manager = | 3145 prerender::PrerenderManager* prerender_manager = |
| 3149 prerender::PrerenderManagerFactory::GetForProfile(profile); | 3146 prerender::PrerenderManagerFactory::GetForBrowserContext( |
| 3147 web_contents->GetBrowserContext()); |
| 3150 if (prerender_manager && | 3148 if (prerender_manager && |
| 3151 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { | 3149 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { |
| 3152 *visibility_state = blink::WebPageVisibilityStatePrerender; | 3150 *visibility_state = blink::WebPageVisibilityStatePrerender; |
| 3153 } | 3151 } |
| 3154 } | 3152 } |
| 3155 | 3153 |
| 3156 #if defined(ENABLE_WEBRTC) | 3154 #if defined(ENABLE_WEBRTC) |
| 3157 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( | 3155 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( |
| 3158 base::CommandLine* to_command_line, | 3156 base::CommandLine* to_command_line, |
| 3159 const base::CommandLine& from_command_line, | 3157 const base::CommandLine& from_command_line, |
| 3160 version_info::Channel channel) { | 3158 version_info::Channel channel) { |
| 3161 #if defined(OS_ANDROID) | 3159 #if defined(OS_ANDROID) |
| 3162 const version_info::Channel kMaxDisableEncryptionChannel = | 3160 const version_info::Channel kMaxDisableEncryptionChannel = |
| 3163 version_info::Channel::BETA; | 3161 version_info::Channel::BETA; |
| 3164 #else | 3162 #else |
| 3165 const version_info::Channel kMaxDisableEncryptionChannel = | 3163 const version_info::Channel kMaxDisableEncryptionChannel = |
| 3166 version_info::Channel::DEV; | 3164 version_info::Channel::DEV; |
| 3167 #endif | 3165 #endif |
| 3168 if (channel <= kMaxDisableEncryptionChannel) { | 3166 if (channel <= kMaxDisableEncryptionChannel) { |
| 3169 static const char* const kWebRtcDevSwitchNames[] = { | 3167 static const char* const kWebRtcDevSwitchNames[] = { |
| 3170 switches::kDisableWebRtcEncryption, | 3168 switches::kDisableWebRtcEncryption, |
| 3171 }; | 3169 }; |
| 3172 to_command_line->CopySwitchesFrom(from_command_line, | 3170 to_command_line->CopySwitchesFrom(from_command_line, |
| 3173 kWebRtcDevSwitchNames, | 3171 kWebRtcDevSwitchNames, |
| 3174 arraysize(kWebRtcDevSwitchNames)); | 3172 arraysize(kWebRtcDevSwitchNames)); |
| 3175 } | 3173 } |
| 3176 } | 3174 } |
| 3177 #endif // defined(ENABLE_WEBRTC) | 3175 #endif // defined(ENABLE_WEBRTC) |
| OLD | NEW |