Chromium Code Reviews| Index: chrome/browser/autocomplete/keyword_provider.cc |
| diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc |
| index c37da20e228f36040e821a071aecc4df86b70668..a0cc99a1380e4cd3732f4b23188d4779b6e625a5 100644 |
| --- a/chrome/browser/autocomplete/keyword_provider.cc |
| +++ b/chrome/browser/autocomplete/keyword_provider.cc |
| @@ -136,25 +136,26 @@ string16 KeywordProvider::SplitReplacementStringFromInput( |
| // static |
| const TemplateURL* KeywordProvider::GetSubstitutingTemplateURLForInput( |
| - Profile* profile, |
| - const AutocompleteInput& input, |
| - string16* remaining_input) { |
| - if (!input.allow_exact_keyword_match()) |
| + TemplateURLService* model, |
| + AutocompleteInput* input) { |
| + if (!input->allow_exact_keyword_match()) |
| return NULL; |
| - string16 keyword; |
| - if (!ExtractKeywordFromInput(input, &keyword, remaining_input)) |
| + string16 keyword, remaining_input; |
| + if (!ExtractKeywordFromInput(*input, &keyword, &remaining_input)) |
| return NULL; |
| - // Make sure the model is loaded. This is cheap and quickly bails out if |
| - // the model is already loaded. |
| - TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(profile); |
| DCHECK(model); |
| - model->Load(); |
| - |
| const TemplateURL* template_url = model->GetTemplateURLForKeyword(keyword); |
| - return (template_url && template_url->SupportsReplacement()) ? |
| - template_url : NULL; |
| + if (template_url && template_url->SupportsReplacement()) { |
| + // TODO(bartn): For now, none of the keyword providers support cursor |
| + // position, so let's not bother with adjusting it to reflect the stripped |
| + // keyword part from the input. |
|
Mark P
2013/01/24 04:07:21
Some people do their searches using google as a ke
Bart N.
2013/01/24 18:32:04
You are right. I forgot about this case (BTW, any
Mark P
2013/01/24 19:32:15
I assume cursor position mucking happens at a simi
|
| + input->UpdateText(remaining_input, string16::npos, input->parts()); |
| + return template_url; |
| + } |
| + |
| + return NULL; |
| } |
| string16 KeywordProvider::GetKeywordForText( |