| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 // | 4 // | 
| 5 // This file contains the keyword autocomplete provider. The keyword provider | 5 // This file contains the keyword autocomplete provider. The keyword provider | 
| 6 // is responsible for remembering/suggesting user "search keyword queries" | 6 // is responsible for remembering/suggesting user "search keyword queries" | 
| 7 // (e.g.  "imdb Godzilla") and then fixing them up into valid URLs.  An | 7 // (e.g.  "imdb Godzilla") and then fixing them up into valid URLs.  An | 
| 8 // instance of it gets created and managed by the autocomplete controller. | 8 // instance of it gets created and managed by the autocomplete controller. | 
| 9 // KeywordProvider uses a TemplateURLService to find the set of keywords. | 9 // KeywordProvider uses a TemplateURLService to find the set of keywords. | 
| 10 | 10 | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 65 | 65 | 
| 66   // Returns the replacement string from the user input. The replacement | 66   // Returns the replacement string from the user input. The replacement | 
| 67   // string is the portion of the input that does not contain the keyword. | 67   // string is the portion of the input that does not contain the keyword. | 
| 68   // For example, the replacement string for "b blah" is blah. | 68   // For example, the replacement string for "b blah" is blah. | 
| 69   // If |trim_leading_whitespace| is true then leading whitespace in | 69   // If |trim_leading_whitespace| is true then leading whitespace in | 
| 70   // replacement string will be trimmed. | 70   // replacement string will be trimmed. | 
| 71   static string16 SplitReplacementStringFromInput(const string16& input, | 71   static string16 SplitReplacementStringFromInput(const string16& input, | 
| 72                                                   bool trim_leading_whitespace); | 72                                                   bool trim_leading_whitespace); | 
| 73 | 73 | 
| 74   // Returns the matching substituting keyword for |input|, or NULL if there | 74   // Returns the matching substituting keyword for |input|, or NULL if there | 
| 75   // is no keyword for the specified input. | 75   // is no keyword for the specified input.  If the matching keyword was found, | 
|  | 76   // updates |input|'s text and cursor position. | 
| 76   static const TemplateURL* GetSubstitutingTemplateURLForInput( | 77   static const TemplateURL* GetSubstitutingTemplateURLForInput( | 
| 77                                               Profile* profile, | 78       TemplateURLService* model, | 
| 78                                               const AutocompleteInput& input, | 79       AutocompleteInput* input); | 
| 79                                               string16* remaining_input); |  | 
| 80 | 80 | 
| 81   // If |text| corresponds (in the sense of | 81   // If |text| corresponds (in the sense of | 
| 82   // TemplateURLModel::CleanUserInputKeyword()) to an enabled, substituting | 82   // TemplateURLModel::CleanUserInputKeyword()) to an enabled, substituting | 
| 83   // keyword, returns that keyword; returns the empty string otherwise. | 83   // keyword, returns that keyword; returns the empty string otherwise. | 
| 84   string16 GetKeywordForText(const string16& text) const; | 84   string16 GetKeywordForText(const string16& text) const; | 
| 85 | 85 | 
| 86   // Creates a fully marked-up AutocompleteMatch for a specific keyword. | 86   // Creates a fully marked-up AutocompleteMatch for a specific keyword. | 
| 87   AutocompleteMatch CreateAutocompleteMatch(const string16& text, | 87   AutocompleteMatch CreateAutocompleteMatch(const string16& text, | 
| 88                                             const string16& keyword, | 88                                             const string16& keyword, | 
| 89                                             const AutocompleteInput& input); | 89                                             const AutocompleteInput& input); | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 166   // If non-empty, holds the ID of the extension whose keyword is currently in | 166   // If non-empty, holds the ID of the extension whose keyword is currently in | 
| 167   // the URL bar while the autocomplete popup is open. | 167   // the URL bar while the autocomplete popup is open. | 
| 168   std::string current_keyword_extension_id_; | 168   std::string current_keyword_extension_id_; | 
| 169 | 169 | 
| 170   content::NotificationRegistrar registrar_; | 170   content::NotificationRegistrar registrar_; | 
| 171 | 171 | 
| 172   DISALLOW_COPY_AND_ASSIGN(KeywordProvider); | 172   DISALLOW_COPY_AND_ASSIGN(KeywordProvider); | 
| 173 }; | 173 }; | 
| 174 | 174 | 
| 175 #endif  // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ | 175 #endif  // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ | 
| OLD | NEW | 
|---|