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 | |
67 // AutocompleteProvider: | 57 // AutocompleteProvider: |
68 virtual void Stop(bool clear_cached_results) OVERRIDE; | 58 virtual void Stop(bool clear_cached_results) OVERRIDE; |
69 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; | 59 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; |
70 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; | 60 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; |
71 | 61 |
72 bool field_trial_triggered_in_session() const { | 62 bool field_trial_triggered_in_session() const { |
73 return field_trial_triggered_in_session_; | 63 return field_trial_triggered_in_session_; |
74 } | 64 } |
75 | 65 |
76 protected: | 66 protected: |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 467 |
478 // Each deletion handler in this vector corresponds to an outstanding request | 468 // Each deletion handler in this vector corresponds to an outstanding request |
479 // that a server delete a personalized suggestion. Making this a ScopedVector | 469 // that a server delete a personalized suggestion. Making this a ScopedVector |
480 // causes us to auto-cancel all such requests on shutdown. | 470 // causes us to auto-cancel all such requests on shutdown. |
481 SuggestionDeletionHandlers deletion_handlers_; | 471 SuggestionDeletionHandlers deletion_handlers_; |
482 | 472 |
483 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 473 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
484 }; | 474 }; |
485 | 475 |
486 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 476 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
OLD | NEW |