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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 public: | 155 public: |
156 // Various values used in scoring, made public so other providers | 156 // Various values used in scoring, made public so other providers |
157 // can insert results in appropriate ranges relative to these. | 157 // can insert results in appropriate ranges relative to these. |
158 static const int kScoreForBestInlineableResult; | 158 static const int kScoreForBestInlineableResult; |
159 static const int kScoreForUnvisitedIntranetResult; | 159 static const int kScoreForUnvisitedIntranetResult; |
160 static const int kScoreForWhatYouTypedResult; | 160 static const int kScoreForWhatYouTypedResult; |
161 static const int kBaseScoreForNonInlineableResult; | 161 static const int kBaseScoreForNonInlineableResult; |
162 | 162 |
163 HistoryURLProvider(AutocompleteProviderListener* listener, Profile* profile); | 163 HistoryURLProvider(AutocompleteProviderListener* listener, Profile* profile); |
164 | 164 |
165 // Returns a match corresponding to exactly what the user has typed. | 165 // HistoryProvider: |
166 // |trim_http| should not be set to true if |input| contains an http | |
167 // prefix. | |
168 // NOTE: This does not set the relevance of the returned match, as different | |
169 // callers want different behavior. Callers must set this manually. | |
170 // This function is static so SearchProvider may construct similar matches. | |
171 static AutocompleteMatch SuggestExactInput(AutocompleteProvider* provider, | |
172 const AutocompleteInput& input, | |
173 bool trim_http); | |
174 | |
175 // AutocompleteProvider | |
176 virtual void Start(const AutocompleteInput& input, | 166 virtual void Start(const AutocompleteInput& input, |
177 bool minimal_changes) OVERRIDE; | 167 bool minimal_changes) OVERRIDE; |
178 virtual void Stop(bool clear_cached_results) OVERRIDE; | 168 virtual void Stop(bool clear_cached_results) OVERRIDE; |
179 | 169 |
| 170 // Returns a match representing a navigation to |destination_url| given user |
| 171 // input of |text|. |trim_http| controls whether the match's |fill_into_edit| |
| 172 // and |contents| should have any HTTP scheme stripped off, and should not be |
| 173 // set to true if |text| contains an http prefix. |
| 174 // NOTE: This does not set the relevance of the returned match, as different |
| 175 // callers want different behavior. Callers must set this manually. |
| 176 AutocompleteMatch SuggestExactInput(const string16& text, |
| 177 const GURL& destination_url, |
| 178 bool trim_http); |
| 179 |
180 // Runs the history query on the history thread, called by the history | 180 // Runs the history query on the history thread, called by the history |
181 // system. The history database MAY BE NULL in which case it is not | 181 // system. The history database MAY BE NULL in which case it is not |
182 // available and we should return no data. Also schedules returning the | 182 // available and we should return no data. Also schedules returning the |
183 // results to the main thread | 183 // results to the main thread |
184 void ExecuteWithDB(history::HistoryBackend* backend, | 184 void ExecuteWithDB(history::HistoryBackend* backend, |
185 history::URLDatabase* db, | 185 history::URLDatabase* db, |
186 HistoryURLProviderParams* params); | 186 HistoryURLProviderParams* params); |
187 | 187 |
188 // Actually runs the autocomplete job on the given database, which is | 188 // Actually runs the autocomplete job on the given database, which is |
189 // guaranteed not to be NULL. | 189 // guaranteed not to be NULL. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // URL-what-you-typed was visited before or not. If false, the only | 315 // URL-what-you-typed was visited before or not. If false, the only |
316 // possible result that HistoryURL provider can return is | 316 // possible result that HistoryURL provider can return is |
317 // URL-what-you-typed. This variable is not part of params_ because | 317 // URL-what-you-typed. This variable is not part of params_ because |
318 // it never changes after the HistoryURLProvider is initialized. | 318 // it never changes after the HistoryURLProvider is initialized. |
319 // It's used to aid the transition to get all URLs from history to | 319 // It's used to aid the transition to get all URLs from history to |
320 // be scored in the HistoryQuick provider only. | 320 // be scored in the HistoryQuick provider only. |
321 bool search_url_database_; | 321 bool search_url_database_; |
322 }; | 322 }; |
323 | 323 |
324 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 324 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
OLD | NEW |