OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // the first intervening whitespace). | 97 // the first intervening whitespace). |
98 // If |trim_leading_whitespace| is true then leading whitespace in | 98 // If |trim_leading_whitespace| is true then leading whitespace in |
99 // |*remaining_input| will be trimmed. | 99 // |*remaining_input| will be trimmed. |
100 static string16 SplitKeywordFromInput(const string16& input, | 100 static string16 SplitKeywordFromInput(const string16& input, |
101 bool trim_leading_whitespace, | 101 bool trim_leading_whitespace, |
102 string16* remaining_input); | 102 string16* remaining_input); |
103 | 103 |
104 // Fills in the "destination_url" and "contents" fields of |match| with the | 104 // Fills in the "destination_url" and "contents" fields of |match| with the |
105 // provided user input and keyword data. | 105 // provided user input and keyword data. |
106 static void FillInURLAndContents( | 106 static void FillInURLAndContents( |
| 107 Profile* profile, |
107 const string16& remaining_input, | 108 const string16& remaining_input, |
108 const TemplateURL* element, | 109 const TemplateURL* element, |
109 AutocompleteMatch* match); | 110 AutocompleteMatch* match); |
110 | 111 |
111 // Determines the relevance for some input, given its type, whether the user | 112 // Determines the relevance for some input, given its type, whether the user |
112 // typed the complete keyword, and whether the user is in "prefer keyword | 113 // typed the complete keyword, and whether the user is in "prefer keyword |
113 // matches" mode, and whether the keyword supports replacement. | 114 // matches" mode, and whether the keyword supports replacement. |
114 // If |allow_exact_keyword_match| is false, the relevance for complete | 115 // If |allow_exact_keyword_match| is false, the relevance for complete |
115 // keywords that support replacements is degraded. | 116 // keywords that support replacements is degraded. |
116 static int CalculateRelevance(AutocompleteInput::Type type, | 117 static int CalculateRelevance(AutocompleteInput::Type type, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // If non-empty, holds the ID of the extension whose keyword is currently in | 158 // If non-empty, holds the ID of the extension whose keyword is currently in |
158 // the URL bar while the autocomplete popup is open. | 159 // the URL bar while the autocomplete popup is open. |
159 std::string current_keyword_extension_id_; | 160 std::string current_keyword_extension_id_; |
160 | 161 |
161 NotificationRegistrar registrar_; | 162 NotificationRegistrar registrar_; |
162 | 163 |
163 DISALLOW_COPY_AND_ASSIGN(KeywordProvider); | 164 DISALLOW_COPY_AND_ASSIGN(KeywordProvider); |
164 }; | 165 }; |
165 | 166 |
166 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ | 167 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ |
OLD | NEW |