OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 class contains common functionality for search-based autocomplete | 5 // This class contains common functionality for search-based autocomplete |
6 // providers. Search provider and zero suggest provider both use it for common | 6 // providers. Search provider and zero suggest provider both use it for common |
7 // functionality. | 7 // functionality. |
8 | 8 |
9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
(...skipping 25 matching lines...) Expand all Loading... |
36 public net::URLFetcherDelegate { | 36 public net::URLFetcherDelegate { |
37 public: | 37 public: |
38 BaseSearchProvider(AutocompleteProviderListener* listener, | 38 BaseSearchProvider(AutocompleteProviderListener* listener, |
39 Profile* profile, | 39 Profile* profile, |
40 AutocompleteProvider::Type type); | 40 AutocompleteProvider::Type type); |
41 | 41 |
42 // Returns whether |match| is flagged as a query that should be prefetched. | 42 // Returns whether |match| is flagged as a query that should be prefetched. |
43 static bool ShouldPrefetch(const AutocompleteMatch& match); | 43 static bool ShouldPrefetch(const AutocompleteMatch& match); |
44 | 44 |
45 // AutocompleteProvider: | 45 // AutocompleteProvider: |
| 46 virtual void Stop(bool clear_cached_results) OVERRIDE; |
46 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; | 47 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; |
47 | 48 |
48 bool field_trial_triggered_in_session() const { | 49 bool field_trial_triggered_in_session() const { |
49 return field_trial_triggered_in_session_; | 50 return field_trial_triggered_in_session_; |
50 } | 51 } |
51 | 52 |
52 protected: | 53 protected: |
53 // The following keys are used to record additional information on matches. | 54 // The following keys are used to record additional information on matches. |
54 | 55 |
55 // We annotate our AutocompleteMatches with whether their relevance scores | 56 // We annotate our AutocompleteMatches with whether their relevance scores |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 352 |
352 // Returns the AutocompleteInput based on whether the |result| is from the | 353 // Returns the AutocompleteInput based on whether the |result| is from the |
353 // default provider or from the keyword provider. | 354 // default provider or from the keyword provider. |
354 virtual const AutocompleteInput GetInput( | 355 virtual const AutocompleteInput GetInput( |
355 const SuggestResult& result) const = 0; | 356 const SuggestResult& result) const = 0; |
356 | 357 |
357 // Returns whether the destination URL corresponding to the given |result| | 358 // Returns whether the destination URL corresponding to the given |result| |
358 // should contain command-line-specified query params. | 359 // should contain command-line-specified query params. |
359 virtual bool ShouldAppendExtraParams(const SuggestResult& result) const = 0; | 360 virtual bool ShouldAppendExtraParams(const SuggestResult& result) const = 0; |
360 | 361 |
| 362 // Stops the suggest query. |
| 363 // NOTE: This does not update |done_|. Callers must do so. |
| 364 virtual void StopSuggest() = 0; |
| 365 |
| 366 // Clears the current results. |
| 367 virtual void ClearAllResults() = 0; |
| 368 |
361 // Whether a field trial, if any, has triggered in the most recent | 369 // Whether a field trial, if any, has triggered in the most recent |
362 // autocomplete query. This field is set to true only if the suggestion | 370 // autocomplete query. This field is set to true only if the suggestion |
363 // provider has completed and the response contained | 371 // provider has completed and the response contained |
364 // '"google:fieldtrialtriggered":true'. | 372 // '"google:fieldtrialtriggered":true'. |
365 bool field_trial_triggered_; | 373 bool field_trial_triggered_; |
366 | 374 |
367 // Same as above except that it is maintained across the current Omnibox | 375 // Same as above except that it is maintained across the current Omnibox |
368 // session. | 376 // session. |
369 bool field_trial_triggered_in_session_; | 377 bool field_trial_triggered_in_session_; |
370 | 378 |
371 private: | 379 private: |
372 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 380 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
373 }; | 381 }; |
374 | 382 |
375 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 383 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
OLD | NEW |