summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_popup_model.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_popup_model.cc')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_model.cc27
1 files changed, 6 insertions, 21 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/autocomplete/autocomplete_popup_model.cc
index 041e1f0..0cc2412 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_model.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_model.cc
@@ -132,27 +132,12 @@ bool AutocompletePopupModel::GetKeywordForMatch(const AutocompleteMatch& match,
// Assume we have no keyword until we find otherwise.
keyword->clear();
- if (match.template_url) {
- TemplateURLService* url_service =
- TemplateURLServiceFactory::GetForProfile(edit_model_->profile());
- if (!url_service)
- return false;
-
- // Only show the keyword for the default provider if the user typed in
- // the keyword and it isn't SEARCH_WHAT_YOU_TYPED.
- const TemplateURL* default_url = url_service->GetDefaultSearchProvider();
- if (default_url && (default_url->id() == match.template_url->id())) {
- if (StartsWith(autocomplete_controller()->input().text(),
- default_url->keyword(), false) &&
- (match.type != AutocompleteMatch::SEARCH_WHAT_YOU_TYPED)) {
- keyword->assign(match.template_url->keyword());
- return false;
- }
- } else if (TemplateURL::SupportsReplacement(match.template_url)) {
- // The current match is a keyword, return that as the selected keyword.
- keyword->assign(match.template_url->keyword());
- return false;
- }
+ if (match.template_url &&
+ TemplateURL::SupportsReplacement(match.template_url) &&
+ match.transition == PageTransition::KEYWORD) {
+ // The current match is a keyword, return that as the selected keyword.
+ keyword->assign(match.template_url->keyword());
+ return false;
}
// See if the current match's fill_into_edit corresponds to a keyword.