Chromium Code Reviews| Index: chrome/browser/autocomplete/keyword_provider.cc |
| =================================================================== |
| --- chrome/browser/autocomplete/keyword_provider.cc (revision 93757) |
| +++ chrome/browser/autocomplete/keyword_provider.cc (working copy) |
| @@ -185,11 +185,12 @@ |
| !remaining_input.empty(), |
| &keyword_matches); |
| - // Prune any extension keywords that are disallowed in incognito mode (if |
| - // we're incognito), or disabled. |
| for (std::vector<string16>::iterator i(keyword_matches.begin()); |
| i != keyword_matches.end(); ) { |
| const TemplateURL* template_url(model->GetTemplateURLForKeyword(*i)); |
| + |
| + // Prune any extension keywords that are disallowed in incognito mode (if |
| + // we're incognito), or disabled. |
| if (profile_ && |
| input.matches_requested() == AutocompleteInput::ALL_MATCHES && |
| template_url->IsExtensionKeyword()) { |
| @@ -204,6 +205,14 @@ |
| continue; |
| } |
| } |
| + |
| + // Prune any substituting keywords if there is no substitution. |
| + if (TemplateURL::SupportsReplacement(template_url) && |
| + !input.allow_exact_keyword_match()) { |
| + i = keyword_matches.erase(i); |
| + continue; |
| + } |
| + |
| ++i; |
| } |
| if (keyword_matches.empty()) |
| @@ -390,6 +399,14 @@ |
| AutocompleteMatch KeywordProvider::CreateAutocompleteMatch( |
| TemplateURLService* model, |
| const string16& keyword, |
| + const AutocompleteInput& input) { |
| + return CreateAutocompleteMatch(model, keyword, input, keyword.size(), |
| + string16(), 0); |
| +} |
| + |
| +AutocompleteMatch KeywordProvider::CreateAutocompleteMatch( |
| + TemplateURLService* model, |
| + const string16& keyword, |
| const AutocompleteInput& input, |
| size_t prefix_length, |
| const string16& remaining_input, |
| @@ -432,8 +449,8 @@ |
| // into keyword templates. |
| FillInURLAndContents(remaining_input, element, &result); |
| - if (supports_replacement) |
|
Peter Kasting
2011/07/27 20:18:25
Do you know why the old code had this conditional?
aaron.randolph
2011/07/28 16:01:55
I think this may have been an artifact of some ear
|
| - result.template_url = element; |
| + result.template_url = element; |
| + result.keyword = keyword; |
| result.transition = PageTransition::KEYWORD; |
| return result; |