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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // component of the history system. See comments above. | 183 // component of the history system. See comments above. |
184 class HistoryURLProvider : public HistoryProvider { | 184 class HistoryURLProvider : public HistoryProvider { |
185 public: | 185 public: |
186 // Various values used in scoring, made public so other providers | 186 // Various values used in scoring, made public so other providers |
187 // can insert results in appropriate ranges relative to these. | 187 // can insert results in appropriate ranges relative to these. |
188 static const int kScoreForBestInlineableResult; | 188 static const int kScoreForBestInlineableResult; |
189 static const int kScoreForUnvisitedIntranetResult; | 189 static const int kScoreForUnvisitedIntranetResult; |
190 static const int kScoreForWhatYouTypedResult; | 190 static const int kScoreForWhatYouTypedResult; |
191 static const int kBaseScoreForNonInlineableResult; | 191 static const int kBaseScoreForNonInlineableResult; |
192 | 192 |
193 HistoryURLProvider(AutocompleteProviderListener* listener, Profile* profile); | 193 HistoryURLProvider(AutocompleteProviderClient* client, |
| 194 AutocompleteProviderListener* listener, |
| 195 Profile* profile); |
194 | 196 |
195 // HistoryProvider: | 197 // HistoryProvider: |
196 void Start(const AutocompleteInput& input, | 198 void Start(const AutocompleteInput& input, |
197 bool minimal_changes, | 199 bool minimal_changes, |
198 bool called_due_to_focus) override; | 200 bool called_due_to_focus) override; |
199 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; | 201 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; |
200 | 202 |
201 // Returns a match representing a navigation to |destination_url| given user | 203 // Returns a match representing a navigation to |destination_url| given user |
202 // input of |text|. |trim_http| controls whether the match's |fill_into_edit| | 204 // input of |text|. |trim_http| controls whether the match's |fill_into_edit| |
203 // and |contents| should have any HTTP scheme stripped off, and should not be | 205 // and |contents| should have any HTTP scheme stripped off, and should not be |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Converts a specified |match_number| from params.matches into an | 319 // Converts a specified |match_number| from params.matches into an |
318 // autocomplete match for display. If experimental scoring is enabled, the | 320 // autocomplete match for display. If experimental scoring is enabled, the |
319 // final relevance score might be different from the given |relevance|. | 321 // final relevance score might be different from the given |relevance|. |
320 // NOTE: This function should only be called on the UI thread. | 322 // NOTE: This function should only be called on the UI thread. |
321 AutocompleteMatch HistoryMatchToACMatch( | 323 AutocompleteMatch HistoryMatchToACMatch( |
322 const HistoryURLProviderParams& params, | 324 const HistoryURLProviderParams& params, |
323 size_t match_number, | 325 size_t match_number, |
324 MatchType match_type, | 326 MatchType match_type, |
325 int relevance); | 327 int relevance); |
326 | 328 |
| 329 Profile* profile_; |
327 AutocompleteProviderListener* listener_; | 330 AutocompleteProviderListener* listener_; |
328 | 331 |
329 // Params for the current query. The provider should not free this directly; | 332 // Params for the current query. The provider should not free this directly; |
330 // instead, it is passed as a parameter through the history backend, and the | 333 // instead, it is passed as a parameter through the history backend, and the |
331 // parameter itself is freed once it's no longer needed. The only reason we | 334 // parameter itself is freed once it's no longer needed. The only reason we |
332 // keep this member is so we can set the cancel bit on it. | 335 // keep this member is so we can set the cancel bit on it. |
333 HistoryURLProviderParams* params_; | 336 HistoryURLProviderParams* params_; |
334 | 337 |
335 // Params controlling experimental behavior of this provider. | 338 // Params controlling experimental behavior of this provider. |
336 HUPScoringParams scoring_params_; | 339 HUPScoringParams scoring_params_; |
337 | 340 |
338 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); | 341 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); |
339 }; | 342 }; |
340 | 343 |
341 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 344 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
OLD | NEW |