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

Unified Diff: chrome/browser/search/search.cc

Issue 2134133002: Introduce search::IsInstantNTPURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « chrome/browser/search/search.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/search.cc
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 3df6a76540ea0ffc1b450d8b3147feda6be8318b..60f2cd302638dab7dda994a04c54b898da13cc41 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -411,12 +411,18 @@ bool NavEntryIsInstantNTP(const content::WebContents* contents,
if (!IsRenderedInInstantProcess(contents, profile))
return false;
- if (entry->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl))
+ return IsInstantNTPURL(entry->GetURL(), profile);
+}
+
+bool IsInstantNTPURL(const GURL& url, Profile* profile) {
+ if (!IsInstantExtendedAPIEnabled())
+ return false;
+
+ if (url == GURL(chrome::kChromeSearchLocalNtpUrl))
return true;
GURL new_tab_url(GetNewTabPageURL(profile));
- return new_tab_url.is_valid() &&
- MatchesOriginAndPath(entry->GetURL(), new_tab_url);
+ return new_tab_url.is_valid() && MatchesOriginAndPath(url, new_tab_url);
}
bool IsSuggestPrefEnabled(Profile* profile) {
@@ -563,13 +569,7 @@ bool HandleNewTabURLReverseRewrite(GURL* url,
if (profile && profile->IsOffTheRecord())
return false;
- if (MatchesOriginAndPath(GURL(chrome::kChromeSearchLocalNtpUrl), *url)) {
- *url = GURL(chrome::kChromeUINewTabURL);
- return true;
- }
-
- GURL new_tab_url(GetNewTabPageURL(profile));
- if (new_tab_url.is_valid() && MatchesOriginAndPath(new_tab_url, *url)) {
+ if (IsInstantNTPURL(*url, profile)) {
*url = GURL(chrome::kChromeUINewTabURL);
return true;
}
« no previous file with comments | « chrome/browser/search/search.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698