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

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

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Enabled pressing TAB to cycle through the Omnibox results, removed moving the caret to the Created 9 years, 9 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/autocomplete/autocomplete_match.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_match.cc (revision 79782)
+++ chrome/browser/autocomplete/autocomplete_match.cc (working copy)
@@ -106,6 +106,29 @@
}
// static
+bool AutocompleteMatch::NormalizedSortFunc(const AutocompleteMatch& elem1,
+ const AutocompleteMatch& elem2) {
+ // Sort identical normalized_urls together. Place the most relevant matches
+ // first, so that when we call std::unique(), these are the ones that get
+ // preserved.
+ return (elem1.normalized_url != elem2.normalized_url) ?
+ (elem1.normalized_url < elem2.normalized_url) :
+ MoreRelevant(elem1, elem2);
+}
+
+// static
+bool AutocompleteMatch::NormalizedEqual(const AutocompleteMatch& elem1,
+ const AutocompleteMatch& elem2) {
+ return elem1.normalized_url == elem2.normalized_url;
+}
+
+// static
+bool AutocompleteMatch::KeywordsEqual(const AutocompleteMatch& elem1,
+ const AutocompleteMatch& elem2) {
+ return elem1.keyword == elem2.keyword;
+}
+
+// static
void AutocompleteMatch::ClassifyMatchInString(
const string16& find_text,
const string16& text,
@@ -151,6 +174,26 @@
}
}
+
+void AutocompleteMatch::NormalizeDestination() {
+ static const char prefix[] = "www.";
+ static const int prefix_len = strlen(prefix);
+
+ if (destination_url.is_valid() && normalized_url.is_empty()) {
Peter Kasting 2011/04/01 00:09:09 Nit: I would combine this check with the compare()
+ std::string host = destination_url.host();
+
+ if (host.compare(0, prefix_len, prefix) == 0) {
+ host.erase(0, prefix_len);
Peter Kasting 2011/04/01 00:09:09 Nit: You can eliminate this and use host.substr(..
+
+ GURL::Replacements replace_host;
+ replace_host.SetHostStr(host);
+ normalized_url = destination_url.ReplaceComponents(replace_host);
+ } else {
+ normalized_url = destination_url;
+ }
+ }
+}
+
#ifndef NDEBUG
void AutocompleteMatch::Validate() const {
ValidateClassifications(contents, contents_class);

Powered by Google App Engine
This is Rietveld 408576698