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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 virtual void Start(const AutocompleteInput& input, | 166 virtual void Start(const AutocompleteInput& input, |
167 bool minimal_changes) OVERRIDE; | 167 bool minimal_changes) OVERRIDE; |
168 virtual void Stop(bool clear_cached_results) OVERRIDE; | 168 virtual void Stop(bool clear_cached_results) OVERRIDE; |
169 | 169 |
170 // Returns a match representing a navigation to |destination_url| given user | 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| | 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 | 172 // and |contents| should have any HTTP scheme stripped off, and should not be |
173 // set to true if |text| contains an http prefix. | 173 // set to true if |text| contains an http prefix. |
174 // NOTE: This does not set the relevance of the returned match, as different | 174 // NOTE: This does not set the relevance of the returned match, as different |
175 // callers want different behavior. Callers must set this manually. | 175 // callers want different behavior. Callers must set this manually. |
176 AutocompleteMatch SuggestExactInput(const string16& text, | 176 AutocompleteMatch SuggestExactInput(const base::string16& text, |
177 const GURL& destination_url, | 177 const GURL& destination_url, |
178 bool trim_http); | 178 bool trim_http); |
179 | 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); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Converts a line from the database into an autocomplete match for display. | 287 // Converts a line from the database into an autocomplete match for display. |
288 AutocompleteMatch HistoryMatchToACMatch( | 288 AutocompleteMatch HistoryMatchToACMatch( |
289 const HistoryURLProviderParams& params, | 289 const HistoryURLProviderParams& params, |
290 const history::HistoryMatch& history_match, | 290 const history::HistoryMatch& history_match, |
291 MatchType match_type, | 291 MatchType match_type, |
292 int relevance); | 292 int relevance); |
293 | 293 |
294 // Returns a set of classifications that highlight all the occurrences | 294 // Returns a set of classifications that highlight all the occurrences |
295 // of |input_text| at word breaks in |description|. | 295 // of |input_text| at word breaks in |description|. |
296 static ACMatchClassifications ClassifyDescription( | 296 static ACMatchClassifications ClassifyDescription( |
297 const string16& input_text, | 297 const base::string16& input_text, |
298 const string16& description); | 298 const base::string16& description); |
299 | 299 |
300 // Params for the current query. The provider should not free this directly; | 300 // Params for the current query. The provider should not free this directly; |
301 // instead, it is passed as a parameter through the history backend, and the | 301 // instead, it is passed as a parameter through the history backend, and the |
302 // parameter itself is freed once it's no longer needed. The only reason we | 302 // parameter itself is freed once it's no longer needed. The only reason we |
303 // keep this member is so we can set the cancel bit on it. | 303 // keep this member is so we can set the cancel bit on it. |
304 HistoryURLProviderParams* params_; | 304 HistoryURLProviderParams* params_; |
305 | 305 |
306 // If true, HistoryURL provider should lookup and cull redirects. If | 306 // If true, HistoryURL provider should lookup and cull redirects. If |
307 // false, it returns matches that may be redirects to each other and | 307 // false, it returns matches that may be redirects to each other and |
308 // simply hopes the default AutoCompleteController behavior to remove | 308 // simply hopes the default AutoCompleteController behavior to remove |
(...skipping 12 matching lines...) Expand all Loading... |
321 // URL-what-you-typed was visited before or not. If false, the only | 321 // URL-what-you-typed was visited before or not. If false, the only |
322 // possible result that HistoryURL provider can return is | 322 // possible result that HistoryURL provider can return is |
323 // URL-what-you-typed. This variable is not part of params_ because | 323 // URL-what-you-typed. This variable is not part of params_ because |
324 // it never changes after the HistoryURLProvider is initialized. | 324 // it never changes after the HistoryURLProvider is initialized. |
325 // It's used to aid the transition to get all URLs from history to | 325 // It's used to aid the transition to get all URLs from history to |
326 // be scored in the HistoryQuick provider only. | 326 // be scored in the HistoryQuick provider only. |
327 bool search_url_database_; | 327 bool search_url_database_; |
328 }; | 328 }; |
329 | 329 |
330 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 330 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
OLD | NEW |