Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4560)

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 13877028: Renderer initiated navigations from non instant process should not fall into instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding tests. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index c51859e0ced7e6fcf7517e0c66d60202763e3211..1e9b4d65d3ac6f79cc0c2461523fb78cce15601a 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -745,17 +745,39 @@ void ChromeContentBrowserClient::RenderProcessHostCreated(
host->Send(new ChromeViewMsg_SetContentSettingRules(rules));
}
+GURL ChromeContentBrowserClient::GetPossiblyPrivilegedURL(
+ content::BrowserContext* browser_context,
+ const GURL& url,
+ bool is_renderer_initiated,
+ content::SiteInstance* curr_instance) {
+ Profile* profile = Profile::FromBrowserContext(browser_context);
+ if (!profile)
+ return url;
+
+ // Only return the privileged instant URL if we are entering from a browser-
+ // initiated navigation or if we are already in the instant process.
+ bool is_instant_process = false;
+ int process_id = curr_instance->GetProcess()->GetID();
+ InstantService* instant_service =
+ InstantServiceFactory::GetForProfile(profile);
+ if (instant_service)
+ is_instant_process = instant_service->IsInstantProcess(process_id);
+ if (!is_renderer_initiated || is_instant_process) {
+ // If the input |url| should be assigned to the Instant renderer, make its
+ // effective URL distinct from other URLs on the search provider's domain.
Charlie Reis 2013/05/01 01:17:54 s/effective/privileged/
Shishir 2013/05/01 07:56:14 Done.
+ if (chrome::ShouldAssignURLToInstantRenderer(url, profile))
+ return GetEffectiveURLForInstant(url, profile);
Charlie Reis 2013/05/01 01:17:54 We should rename this to GetPrivilegedURLForInstan
Shishir 2013/05/01 07:56:14 Done.
+ }
+
+ return url;
+}
+
GURL ChromeContentBrowserClient::GetEffectiveURL(
content::BrowserContext* browser_context, const GURL& url) {
Profile* profile = Profile::FromBrowserContext(browser_context);
if (!profile)
return url;
- // If the input |url| should be assigned to the Instant renderer, make its
- // effective URL distinct from other URLs on the search provider's domain.
- if (chrome::ShouldAssignURLToInstantRenderer(url, profile))
- return GetEffectiveURLForInstant(url, profile);
-
#if !defined(OS_CHROMEOS)
// If the input |url| should be assigned to the Signin renderer, make its
// effective URL distinct from other URLs on the signin service's domain.

Powered by Google App Engine
This is Rietveld 408576698