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

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

Issue 1098843004: Omnibox - Do Not Allow HTTP/HTTPS Equivalence if User Explicitly Entered A Scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactored, as discussed Created 5 years, 6 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/shortcuts_provider.cc
diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc
index 8ead62e723d8dad0cccf6424efd8abfcb4feb7df..ac0a31bd61573e9baf50fdbc63d23d909bf09a94 100644
--- a/chrome/browser/autocomplete/shortcuts_provider.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider.cc
@@ -152,12 +152,17 @@ void ShortcutsProvider::GetMatches(const AutocompleteInput& input) {
if (relevance) {
matches_.push_back(ShortcutToACMatch(it->second, relevance, input,
fixed_up_input));
- matches_.back().ComputeStrippedDestinationURL(template_url_service);
+ matches_.back().ComputeStrippedDestinationURL(input,
+ template_url_service);
}
}
- // Remove duplicates. Duplicates don't need to be preserved in the matches
- // because they are only used for deletions, and shortcuts deletes matches
- // based on the URL.
+ // Remove duplicates. This is important because it's common to have multiple
+ // shortcuts pointing to the same URL, e.g., ma, mai, and mail all pointing
+ // to mail.google.com, so typing "m" will return them all. Note that while
Peter Kasting 2015/06/09 20:36:38 Nit: I might add after "return them all" this sent
Mark P 2015/06/10 23:38:34 Done.
+ // removing duplicates, we don't populate a match's |duplicate_matches|
+ // field--duplicates don't need to be preserved in the matches because they
+ // are only used for deletions, and shortcuts deletes matches based on the
Peter Kasting 2015/06/09 20:36:38 Nit: shortcuts -> this provider?
Mark P 2015/06/10 23:38:34 Sure.
+ // URL.
AutocompleteResult::DedupMatchesByDestination(
input.current_page_classification(), false, &matches_);
// Find best matches.
@@ -236,7 +241,7 @@ AutocompleteMatch ShortcutsProvider::ShortcutToACMatch(
}
}
match.EnsureUWYTIsAllowedToBeDefault(
- input.canonicalized_url(),
+ input,
TemplateURLServiceFactory::GetForProfile(profile_));
// Try to mark pieces of the contents and description as matches if they

Powered by Google App Engine
This is Rietveld 408576698