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

Unified Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 10879042: Move IsHostOnly() from HistoryURL provider to HistoryMatch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Vertical space. Created 8 years, 4 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/autocomplete/history_provider_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/history_url_provider.cc
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc
index 08a9c3490d235dcafac88dfd8de5f479e812ce9f..a028a4cb8841ca4dc3bccba28023be7df4dbbade 100644
--- a/chrome/browser/autocomplete/history_url_provider.cc
+++ b/chrome/browser/autocomplete/history_url_provider.cc
@@ -92,14 +92,6 @@ GURL ConvertToHostOnly(const history::HistoryMatch& match,
return host;
}
-// Returns true if |url| is just a host (e.g. "http://www.google.com/") and not
-// some other subpage (e.g. "http://www.google.com/foo.html").
-bool IsHostOnly(const GURL& url) {
- DCHECK(url.is_valid());
- return (!url.has_path() || (url.path() == "/")) && !url.has_query() &&
- !url.has_ref();
-}
-
// Acts like the > operator for URLInfo classes.
bool CompareHistoryMatch(const history::HistoryMatch& a,
const history::HistoryMatch& b) {
@@ -119,11 +111,8 @@ bool CompareHistoryMatch(const history::HistoryMatch& a,
// For URLs that have each been typed once, a host (alone) is better than a
// page inside.
- if (a.url_info.typed_count() == 1) {
- const bool a_is_host_only = IsHostOnly(a.url_info.url());
- if (a_is_host_only != IsHostOnly(b.url_info.url()))
- return a_is_host_only;
- }
+ if ((a.url_info.typed_count() == 1) && (a.IsHostOnly() != b.IsHostOnly()))
+ return a.IsHostOnly();
// URLs that have been visited more often are better.
if (a.url_info.visit_count() != b.url_info.visit_count())
@@ -674,7 +663,7 @@ bool HistoryURLProvider::PromoteMatchForInlineAutocomplete(
// hand, we wouldn't want to immediately start autocompleting it.
if (!match.url_info.typed_count() ||
((match.url_info.typed_count() == 1) &&
- !IsHostOnly(match.url_info.url())))
+ !match.IsHostOnly()))
return false;
// In the case where the user has typed "foo.com" and visited (but not typed)
« no previous file with comments | « chrome/browser/autocomplete/history_provider_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698