Index: chrome/browser/autocomplete/shortcuts_provider.cc |
diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc |
index 42c58ab5cf873dd0bd51c802bad111c38c1115ee..5c738790bf2f16b30b9106ef96c30227fc46ef50 100644 |
--- a/chrome/browser/autocomplete/shortcuts_provider.cc |
+++ b/chrome/browser/autocomplete/shortcuts_provider.cc |
@@ -141,8 +141,8 @@ void ShortcutsProvider::GetMatches(const AutocompleteInput& input) { |
base::string16 term_string(base::i18n::ToLower(input.text())); |
DCHECK(!term_string.empty()); |
- const GURL& input_as_gurl = |
- url_fixer::FixupURL(base::UTF16ToUTF8(input.text()), std::string()); |
+ TemplateURLService* template_url_service = |
+ TemplateURLServiceFactory::GetForProfile(profile_); |
const base::string16 fixed_up_input(FixupUserInput(input).second); |
Peter Kasting
2014/07/09 00:46:43
Tiny nit: Really we should perhaps be computing th
Mark P
2014/07/09 19:54:17
Done.
|
int max_relevance; |
@@ -158,9 +158,8 @@ void ShortcutsProvider::GetMatches(const AutocompleteInput& input) { |
int relevance = CalculateScore(term_string, it->second, max_relevance); |
if (relevance) { |
matches_.push_back(ShortcutToACMatch(it->second, relevance, input, |
- fixed_up_input, input_as_gurl)); |
- matches_.back().ComputeStrippedDestinationURL( |
- TemplateURLServiceFactory::GetForProfile(profile_)); |
+ fixed_up_input)); |
+ matches_.back().ComputeStrippedDestinationURL(template_url_service); |
} |
} |
// Remove duplicates. Duplicates don't need to be preserved in the matches |
@@ -191,8 +190,7 @@ AutocompleteMatch ShortcutsProvider::ShortcutToACMatch( |
const history::ShortcutsDatabase::Shortcut& shortcut, |
int relevance, |
const AutocompleteInput& input, |
- const base::string16& fixed_up_input_text, |
- const GURL& input_as_gurl) { |
+ const base::string16& fixed_up_input_text) { |
DCHECK(!input.text().empty()); |
AutocompleteMatch match; |
match.provider = this; |
@@ -243,16 +241,11 @@ AutocompleteMatch ShortcutsProvider::ShortcutToACMatch( |
match.allowed_to_be_default_match = |
!HistoryProvider::PreventInlineAutocomplete(input) || |
match.inline_autocompletion.empty(); |
- } else { |
- // Also allow a user's input to be marked as default if it would be fixed |
- // up to the same thing as the fill_into_edit. This handles cases like |
- // the user input containing a trailing slash absent in fill_into_edit. |
- match.allowed_to_be_default_match = |
- (input_as_gurl == |
- url_fixer::FixupURL(base::UTF16ToUTF8(match.fill_into_edit), |
- std::string())); |
} |
} |
+ match.EnsureUWYTIsAllowedToBeDefault( |
+ input.canonicalized_url(), |
+ TemplateURLServiceFactory::GetForProfile(profile_)); |
// Try to mark pieces of the contents and description as matches if they |
// appear in |input.text()|. |