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 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_H_ |
7 | 7 |
| 8 #include <string> |
| 9 #include <utility> |
| 10 #include <vector> |
| 11 |
8 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
9 | 13 |
10 class Profile; | 14 class Profile; |
11 | 15 |
12 namespace chrome { | 16 namespace chrome { |
13 namespace search { | 17 namespace search { |
14 | 18 |
15 // Returns whether the Instant extended API is enabled for the given |profile|. | 19 // Returns whether the Instant extended API is enabled for the given |profile|. |
16 // |profile| may not be NULL. | 20 // |profile| may not be NULL. |
17 bool IsInstantExtendedAPIEnabled(const Profile* profile); | 21 bool IsInstantExtendedAPIEnabled(Profile* profile); |
18 | 22 |
19 // Returns the value to pass to the &espv cgi parameter when loading the | 23 // Returns the value to pass to the &espv cgi parameter when loading the |
20 // embedded search page from the user's default search provider. Will be | 24 // embedded search page from the user's default search provider. Will be |
21 // 0 if the Instant Extended API is not enabled. | 25 // 0 if the Instant Extended API is not enabled. |
22 uint64 EmbeddedSearchPageVersion(const Profile* profile); | 26 uint64 EmbeddedSearchPageVersion(Profile* profile); |
23 | 27 |
24 // Force the instant extended API to be enabled for tests. | 28 // Force the instant extended API to be enabled for tests. |
25 void EnableInstantExtendedAPIForTesting(); | 29 void EnableInstantExtendedAPIForTesting(); |
26 | 30 |
27 // Returns whether query extraction is enabled. | 31 // Returns whether query extraction is enabled. |
28 bool IsQueryExtractionEnabled(const Profile* profile); | 32 bool IsQueryExtractionEnabled(Profile* profile); |
29 | 33 |
30 // Force query extraction to be enabled for tests. | 34 // Force query extraction to be enabled for tests. |
31 void EnableQueryExtractionForTesting(); | 35 void EnableQueryExtractionForTesting(); |
32 | 36 |
| 37 // Type for a collection of experiment configuration parameters. |
| 38 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; |
| 39 |
| 40 // Given a field trial group name, parses out the group number and configuration |
| 41 // flags. |
| 42 // Exposed for testing only. |
| 43 void GetFieldTrialInfo(const std::string& group_name, |
| 44 FieldTrialFlags* flags, |
| 45 uint64* group_number); |
| 46 |
| 47 // Given a FieldTrialFlags object, returns the string value of the provided |
| 48 // flag. |
| 49 // Exposed for testing only. |
| 50 std::string GetStringValueForFlagWithDefault( |
| 51 const std::string& flag, |
| 52 const std::string& default_value, |
| 53 FieldTrialFlags& flags); |
| 54 |
| 55 // Given a FieldTrialFlags object, returns the uint64 value of the provided |
| 56 // flag. |
| 57 // Exposed for testing only. |
| 58 uint64 GetUInt64ValueForFlagWithDefault( |
| 59 const std::string& flag, uint64 default_value, FieldTrialFlags& flags); |
| 60 |
| 61 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
| 62 // Exposed for testing only. |
| 63 bool GetBoolValueForFlagWithDefault( |
| 64 const std::string& flag, bool default_value, FieldTrialFlags& flags); |
| 65 |
33 } // namespace search | 66 } // namespace search |
34 } // namespace chrome | 67 } // namespace chrome |
35 | 68 |
36 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_H_ | 69 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_H_ |
OLD | NEW |