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 autocomplete entries that start with "Search <engine> | 6 // responsible for all autocomplete entries that start with "Search <engine> |
7 // for ...", including searching for the current input string, search | 7 // for ...", including searching for the current input string, search |
8 // history, and search suggestions. An instance of it gets created and | 8 // 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 |
11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
12 #define CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 12 #define CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
19 #include "chrome/browser/autocomplete/base_search_provider.h" | 19 #include "chrome/browser/autocomplete/base_search_provider.h" |
20 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
21 #include "chrome/browser/search_engines/template_url.h" | 21 #include "chrome/browser/search_engines/template_url.h" |
22 #include "components/metrics/proto/omnibox_input_type.pb.h" | |
22 | 23 |
23 class Profile; | 24 class Profile; |
24 class SearchProviderTest; | 25 class SearchProviderTest; |
25 class TemplateURLService; | 26 class TemplateURLService; |
26 | 27 |
27 namespace net { | 28 namespace net { |
28 class URLFetcher; | 29 class URLFetcher; |
29 } | 30 } |
30 | 31 |
31 // Autocomplete provider for searches and suggestions from a search engine. | 32 // Autocomplete provider for searches and suggestions from a search engine. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 SuggestResults* suggest_results, | 131 SuggestResults* suggest_results, |
131 NavigationResults* navigation_results); | 132 NavigationResults* navigation_results); |
132 | 133 |
133 // Recalculates the match contents class of |results| to better display | 134 // Recalculates the match contents class of |results| to better display |
134 // against the current input and user's language. | 135 // against the current input and user's language. |
135 void UpdateMatchContentsClass(const base::string16& input_text, | 136 void UpdateMatchContentsClass(const base::string16& input_text, |
136 Results* results); | 137 Results* results); |
137 | 138 |
138 // Calculates the relevance score for the keyword verbatim result (if the | 139 // Calculates the relevance score for the keyword verbatim result (if the |
139 // input matches one of the profile's keyword). | 140 // input matches one of the profile's keyword). |
140 static int CalculateRelevanceForKeywordVerbatim(AutocompleteInput::Type type, | 141 static int CalculateRelevanceForKeywordVerbatim( |
141 bool prefer_keyword); | 142 metrics::OmniboxInputType::Type type, bool prefer_keyword); |
Ilya Sherman
2014/06/06 05:01:01
nit: In header files, params should always be one
Mark P
2014/06/06 20:22:51
Done.
| |
142 | 143 |
143 // AutocompleteProvider: | 144 // AutocompleteProvider: |
144 virtual void Start(const AutocompleteInput& input, | 145 virtual void Start(const AutocompleteInput& input, |
145 bool minimal_changes) OVERRIDE; | 146 bool minimal_changes) OVERRIDE; |
146 | 147 |
147 // BaseSearchProvider: | 148 // BaseSearchProvider: |
148 virtual void SortResults(bool is_keyword, | 149 virtual void SortResults(bool is_keyword, |
149 const base::ListValue* relevances, | 150 const base::ListValue* relevances, |
150 Results* results) OVERRIDE; | 151 Results* results) OVERRIDE; |
151 virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; | 152 virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 GURL current_page_url_; | 311 GURL current_page_url_; |
311 | 312 |
312 // Session token management. | 313 // Session token management. |
313 std::string current_token_; | 314 std::string current_token_; |
314 base::TimeTicks token_expiration_time_; | 315 base::TimeTicks token_expiration_time_; |
315 | 316 |
316 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 317 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
317 }; | 318 }; |
318 | 319 |
319 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 320 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |