OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_BROWSER_SEARCH_SEARCH_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_SEARCH_H_ |
6 #define CHROME_BROWSER_SEARCH_SEARCH_H_ | 6 #define CHROME_BROWSER_SEARCH_SEARCH_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ORIGIN_CHIP_DISABLED = 0, | 52 ORIGIN_CHIP_DISABLED = 0, |
53 ORIGIN_CHIP_ALWAYS, | 53 ORIGIN_CHIP_ALWAYS, |
54 ORIGIN_CHIP_ON_SRP, | 54 ORIGIN_CHIP_ON_SRP, |
55 ORIGIN_CHIP_NUM_VALUES, | 55 ORIGIN_CHIP_NUM_VALUES, |
56 }; | 56 }; |
57 | 57 |
58 // Use this value for "start margin" to prevent the "es_sm" parameter from | 58 // Use this value for "start margin" to prevent the "es_sm" parameter from |
59 // being used. | 59 // being used. |
60 extern const int kDisableStartMargin; | 60 extern const int kDisableStartMargin; |
61 | 61 |
62 // Returns whether the Instant Extended API is enabled. | |
63 bool IsInstantExtendedAPIEnabled(); | |
64 | |
65 // Returns whether the suggest is enabled for the given |profile|. | 62 // Returns whether the suggest is enabled for the given |profile|. |
66 bool IsSuggestPrefEnabled(Profile* profile); | 63 bool IsSuggestPrefEnabled(Profile* profile); |
67 | 64 |
68 // Returns the value to pass to the &espv CGI parameter when loading the | |
69 // embedded search page from the user's default search provider. Returns 0 if | |
70 // the Instant Extended API is not enabled. | |
71 uint64 EmbeddedSearchPageVersion(); | |
72 | |
73 // Returns a string indicating whether InstantExtended is enabled, suitable | 65 // Returns a string indicating whether InstantExtended is enabled, suitable |
74 // for adding as a query string param to the homepage or search requests. | 66 // for adding as a query string param to the homepage or search requests. |
75 // Returns an empty string otherwise. | 67 // Returns an empty string otherwise. |
76 // | 68 // |
77 // |for_search| should be set to true for search requests, in which case this | 69 // |for_search| should be set to true for search requests, in which case this |
78 // returns a non-empty string only if query extraction is enabled. | 70 // returns a non-empty string only if query extraction is enabled. |
79 std::string InstantExtendedEnabledParam(bool for_search); | 71 std::string InstantExtendedEnabledParam(bool for_search); |
80 | 72 |
81 // Returns a string that will cause the search results page to update | 73 // Returns a string that will cause the search results page to update |
82 // incrementally. Currently, Instant Extended passes a different param to | 74 // incrementally. Currently, Instant Extended passes a different param to |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // Returns true if the field trial flag is enabled to prefetch results on SRP. | 244 // Returns true if the field trial flag is enabled to prefetch results on SRP. |
253 bool ShouldPrefetchSearchResultsOnSRP(); | 245 bool ShouldPrefetchSearchResultsOnSRP(); |
254 | 246 |
255 // ----------------------------------------------------- | 247 // ----------------------------------------------------- |
256 // The following APIs are exposed for use in tests only. | 248 // The following APIs are exposed for use in tests only. |
257 // ----------------------------------------------------- | 249 // ----------------------------------------------------- |
258 | 250 |
259 // Forces query in the omnibox to be on for tests. | 251 // Forces query in the omnibox to be on for tests. |
260 void EnableQueryExtractionForTesting(); | 252 void EnableQueryExtractionForTesting(); |
261 | 253 |
262 // Type for a collection of experiment configuration parameters. | |
263 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; | |
264 | |
265 // Finds the active field trial group name and parses out the configuration | |
266 // flags. On success, |flags| will be filled with the field trial flags. |flags| | |
267 // must not be NULL. Returns true iff the active field trial is successfully | |
268 // parsed and not disabled. | |
269 // Note that |flags| may be successfully populated in some cases when false is | |
270 // returned - in these cases it should not be used. | |
271 // Exposed for testing only. | |
272 bool GetFieldTrialInfo(FieldTrialFlags* flags); | |
273 | |
274 // Given a FieldTrialFlags object, returns the string value of the provided | |
275 // flag. | |
276 // Exposed for testing only. | |
277 std::string GetStringValueForFlagWithDefault(const std::string& flag, | |
278 const std::string& default_value, | |
279 const FieldTrialFlags& flags); | |
280 | |
281 // Given a FieldTrialFlags object, returns the uint64 value of the provided | |
282 // flag. | |
283 // Exposed for testing only. | |
284 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, | |
285 uint64 default_value, | |
286 const FieldTrialFlags& flags); | |
287 | |
288 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | |
289 // Exposed for testing only. | |
290 bool GetBoolValueForFlagWithDefault(const std::string& flag, | |
291 bool default_value, | |
292 const FieldTrialFlags& flags); | |
293 | |
294 // Returns the Cacheable New Tab Page URL for the given |profile|. | 254 // Returns the Cacheable New Tab Page URL for the given |profile|. |
295 GURL GetNewTabPageURL(Profile* profile); | 255 GURL GetNewTabPageURL(Profile* profile); |
296 | 256 |
297 // Returns true if 'use_alternate_instant_url' flag is set to true in field | 257 // Returns true if 'use_alternate_instant_url' flag is set to true in field |
298 // trials to use an alternate Instant search base page URL for prefetching | 258 // trials to use an alternate Instant search base page URL for prefetching |
299 // search results. This allows experimentation of Instant search. | 259 // search results. This allows experimentation of Instant search. |
300 bool ShouldUseAltInstantURL(); | 260 bool ShouldUseAltInstantURL(); |
301 | 261 |
302 } // namespace chrome | 262 } // namespace chrome |
303 | 263 |
304 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 264 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
OLD | NEW |