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

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

Issue 2409423005: Compare GURLs to kUrlConstants with .spec() and string equality (Closed)
Patch Set: git cl format Created 4 years, 2 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/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index 445d160818d85286f98d107430954d9acd866696..6f0c066074a4120b43735339d3cb20ec845278e5 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -67,7 +67,7 @@ bool IsNTP(const content::WebContents* contents) {
// whereas we want the visible entry.
const content::NavigationEntry* entry =
contents->GetController().GetVisibleEntry();
- if (entry && entry->GetVirtualURL() == GURL(chrome::kChromeUINewTabURL))
+ if (entry && entry->GetVirtualURL().spec() == chrome::kChromeUINewTabURL)
return true;
return search::IsInstantNTP(contents);
@@ -78,7 +78,7 @@ bool IsLocal(const content::WebContents* contents) {
return false;
const content::NavigationEntry* entry =
contents->GetController().GetVisibleEntry();
- return entry && entry->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl);
+ return entry && entry->GetURL().spec() == chrome::kChromeSearchLocalNtpUrl;
}
// Returns true if |contents| are rendered inside an Instant process.
@@ -253,7 +253,7 @@ void SearchTabHelper::DidNavigateMainFrame(
content::NavigationEntry* entry =
web_contents_->GetController().GetLastCommittedEntry();
if (entry && entry->GetTitle().empty() &&
- (entry->GetVirtualURL() == GURL(chrome::kChromeUINewTabURL) ||
+ (entry->GetVirtualURL().spec() == chrome::kChromeUINewTabURL ||
search::NavEntryIsInstantNTP(web_contents_, entry))) {
web_contents_->UpdateTitleForEntry(
entry, l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));

Powered by Google App Engine
This is Rietveld 408576698