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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // ID used in creating URLFetcher for deleting suggestion results. | 47 // ID used in creating URLFetcher for deleting suggestion results. |
48 static const int kDeletionURLFetcherID; | 48 static const int kDeletionURLFetcherID; |
49 | 49 |
50 BaseSearchProvider(AutocompleteProviderListener* listener, | 50 BaseSearchProvider(AutocompleteProviderListener* listener, |
51 Profile* profile, | 51 Profile* profile, |
52 AutocompleteProvider::Type type); | 52 AutocompleteProvider::Type type); |
53 | 53 |
54 // Returns whether |match| is flagged as a query that should be prefetched. | 54 // Returns whether |match| is flagged as a query that should be prefetched. |
55 static bool ShouldPrefetch(const AutocompleteMatch& match); | 55 static bool ShouldPrefetch(const AutocompleteMatch& match); |
56 | 56 |
| 57 // Returns a simpler AutocompleteMatch suitable for persistence like in |
| 58 // ShortcutsDatabase. |
| 59 // NOTE: Use with care. Most likely you want the other CreateSearchSuggestion |
| 60 // with protected access. |
| 61 static AutocompleteMatch CreateSearchSuggestion( |
| 62 const base::string16& suggestion, |
| 63 AutocompleteMatchType::Type type, |
| 64 bool from_keyword_provider, |
| 65 const TemplateURL* template_url); |
| 66 |
57 // AutocompleteProvider: | 67 // AutocompleteProvider: |
58 virtual void Stop(bool clear_cached_results) OVERRIDE; | 68 virtual void Stop(bool clear_cached_results) OVERRIDE; |
59 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; | 69 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; |
60 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; | 70 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; |
61 | 71 |
62 bool field_trial_triggered_in_session() const { | 72 bool field_trial_triggered_in_session() const { |
63 return field_trial_triggered_in_session_; | 73 return field_trial_triggered_in_session_; |
64 } | 74 } |
65 | 75 |
66 protected: | 76 protected: |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 477 |
468 // Each deletion handler in this vector corresponds to an outstanding request | 478 // Each deletion handler in this vector corresponds to an outstanding request |
469 // that a server delete a personalized suggestion. Making this a ScopedVector | 479 // that a server delete a personalized suggestion. Making this a ScopedVector |
470 // causes us to auto-cancel all such requests on shutdown. | 480 // causes us to auto-cancel all such requests on shutdown. |
471 SuggestionDeletionHandlers deletion_handlers_; | 481 SuggestionDeletionHandlers deletion_handlers_; |
472 | 482 |
473 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 483 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
474 }; | 484 }; |
475 | 485 |
476 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 486 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
OLD | NEW |