Index: chrome/browser/autocomplete/autocomplete_popup_model.cc |
=================================================================== |
--- chrome/browser/autocomplete/autocomplete_popup_model.cc (revision 80868) |
+++ chrome/browser/autocomplete/autocomplete_popup_model.cc (working copy) |
@@ -101,7 +101,12 @@ |
// TODO(pkasting): If |selected_line_| moves to the controller, this can be |
// eliminated and just become a call to the observer on the edit. |
string16 keyword; |
- const bool is_keyword_hint = GetKeywordForMatch(match, &keyword); |
+ bool is_keyword_hint = false; |
+ |
+ if (match.keyword.get()) { |
+ keyword = match.keyword->text; |
+ is_keyword_hint = match.keyword->is_keyword_hint; |
+ } |
if (reset_to_default) { |
string16 inline_autocomplete_text; |
if ((match.inline_autocomplete_offset != string16::npos) && |
@@ -128,53 +133,6 @@ |
view_->OnDragCanceled(); |
} |
-bool AutocompletePopupModel::GetKeywordForMatch(const AutocompleteMatch& match, |
- string16* keyword) const { |
- // If the current match is a keyword, return that as the selected keyword. |
- if (TemplateURL::SupportsReplacement(match.template_url)) { |
- keyword->assign(match.template_url->keyword()); |
- return false; |
- } |
- |
- // See if the current match's fill_into_edit corresponds to a keyword. |
- return GetKeywordForText(match.fill_into_edit, keyword); |
-} |
- |
-bool AutocompletePopupModel::GetKeywordForText(const string16& text, |
- string16* keyword) const { |
- // Creates keyword_hint first in case |keyword| is a pointer to |text|. |
- const string16 keyword_hint(TemplateURLModel::CleanUserInputKeyword(text)); |
- |
- // Assume we have no keyword until we find otherwise. |
- keyword->clear(); |
- |
- if (keyword_hint.empty()) |
- return false; |
- if (!profile_->GetTemplateURLModel()) |
- return false; |
- profile_->GetTemplateURLModel()->Load(); |
- |
- // Don't provide a hint if this keyword doesn't support replacement. |
- const TemplateURL* const template_url = |
- profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword_hint); |
- if (!TemplateURL::SupportsReplacement(template_url)) |
- return false; |
- |
- // Don't provide a hint for inactive/disabled extension keywords. |
- if (template_url->IsExtensionKeyword()) { |
- const Extension* extension = profile_->GetExtensionService()-> |
- GetExtensionById(template_url->GetExtensionId(), false); |
- if (!extension || |
- (profile_->IsOffTheRecord() && |
- !profile_->GetExtensionService()-> |
- IsIncognitoEnabled(extension->id()))) |
- return false; |
- } |
- |
- keyword->assign(keyword_hint); |
- return true; |
-} |
- |
void AutocompletePopupModel::Move(int count) { |
const AutocompleteResult& result = this->result(); |
if (result.empty()) |