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 // This file contains the Search autocomplete provider. This provider is | 5 // This file contains the Search autocomplete provider. This provider is |
6 // responsible for all non-keyword autocomplete entries that start with | 6 // responsible for all non-keyword autocomplete entries that start with |
7 // "Search <engine> for ...", including searching for the current input string, | 7 // "Search <engine> for ...", including searching for the current input string, |
8 // search history, and search suggestions. An instance of it gets created and | 8 // search history, and search suggestions. An instance of it gets created and |
9 // managed by the autocomplete controller. | 9 // managed by the autocomplete controller. |
10 // | 10 // |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 virtual ~SearchProvider(); | 83 virtual ~SearchProvider(); |
84 | 84 |
85 // Manages the providers (TemplateURLs) used by SearchProvider. Two providers | 85 // Manages the providers (TemplateURLs) used by SearchProvider. Two providers |
86 // may be used: | 86 // may be used: |
87 // . The default provider. This corresponds to the user's default search | 87 // . The default provider. This corresponds to the user's default search |
88 // engine. This is always used, except for the rare case of no default | 88 // engine. This is always used, except for the rare case of no default |
89 // engine. | 89 // engine. |
90 // . The keyword provider. This is used if the user has typed in a keyword. | 90 // . The keyword provider. This is used if the user has typed in a keyword. |
91 class Providers { | 91 class Providers { |
92 public: | 92 public: |
93 Providers() : default_provider_(NULL), keyword_provider_(NULL) {} | 93 Providers() |
| 94 : cached_default_provider_(TemplateURLData()), |
| 95 cached_keyword_provider_(TemplateURLData()), |
| 96 default_provider_(NULL), |
| 97 keyword_provider_(NULL) { |
| 98 } |
94 | 99 |
95 // Returns true if the specified providers match the two providers managed | 100 // Returns true if the specified providers match the two providers managed |
96 // by this class. | 101 // by this class. |
97 bool equals(const TemplateURL* default_provider, | 102 bool equals(const TemplateURL* default_provider, |
98 const TemplateURL* keyword_provider) { | 103 const TemplateURL* keyword_provider) { |
99 return (default_provider == default_provider_ && | 104 return (default_provider == default_provider_ && |
100 keyword_provider == keyword_provider_); | 105 keyword_provider == keyword_provider_); |
101 } | 106 } |
102 | 107 |
103 // Resets the providers. | 108 // Resets the providers. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Has FinalizeInstantQuery been invoked since the last |Start|? | 335 // Has FinalizeInstantQuery been invoked since the last |Start|? |
331 bool instant_finalized_; | 336 bool instant_finalized_; |
332 | 337 |
333 // The |suggest_text| parameter passed to FinalizeInstantQuery. | 338 // The |suggest_text| parameter passed to FinalizeInstantQuery. |
334 string16 default_provider_suggest_text_; | 339 string16 default_provider_suggest_text_; |
335 | 340 |
336 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 341 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
337 }; | 342 }; |
338 | 343 |
339 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 344 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |