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 #ifndef COMPONENTS_SEARCH_SEARCH_H_ | 5 #ifndef COMPONENTS_SEARCH_SEARCH_H_ |
6 #define COMPONENTS_SEARCH_SEARCH_H_ | 6 #define COMPONENTS_SEARCH_SEARCH_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <utility> | 11 #include <utility> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/basictypes.h" | |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
15 | 16 |
16 class GURL; | 17 class GURL; |
17 class TemplateURL; | 18 class TemplateURL; |
18 | 19 |
19 namespace search { | 20 namespace search { |
20 | 21 |
21 // Use this value for "start margin" to prevent the "es_sm" parameter from | 22 // Use this value for "start margin" to prevent the "es_sm" parameter from |
22 // being used. | 23 // being used. |
23 extern const int kDisableStartMargin; | 24 extern const int kDisableStartMargin; |
24 | 25 |
25 // Returns whether the Instant Extended API is enabled. | 26 // Returns whether the Instant Extended API is enabled. |
26 bool IsInstantExtendedAPIEnabled(); | 27 bool IsInstantExtendedAPIEnabled(); |
27 | 28 |
28 // Returns the value to pass to the &espv CGI parameter when loading the | 29 // Returns the value to pass to the &espv CGI parameter when loading the |
29 // embedded search page from the user's default search provider. Returns 0 if | 30 // embedded search page from the user's default search provider. Returns 0 if |
30 // the Instant Extended API is not enabled. | 31 // the Instant Extended API is not enabled. |
31 uint64 EmbeddedSearchPageVersion(); | 32 uint64_t EmbeddedSearchPageVersion(); |
32 | 33 |
33 // Type for a collection of experiment configuration parameters. | 34 // Type for a collection of experiment configuration parameters. |
34 typedef base::StringPairs FieldTrialFlags; | 35 typedef base::StringPairs FieldTrialFlags; |
35 | 36 |
36 // Finds the active field trial group name and parses out the configuration | 37 // Finds the active field trial group name and parses out the configuration |
37 // flags. On success, |flags| will be filled with the field trial flags. |flags| | 38 // flags. On success, |flags| will be filled with the field trial flags. |flags| |
38 // must not be NULL. Returns true iff the active field trial is successfully | 39 // must not be NULL. Returns true iff the active field trial is successfully |
39 // parsed and not disabled. | 40 // parsed and not disabled. |
40 // Note that |flags| may be successfully populated in some cases when false is | 41 // Note that |flags| may be successfully populated in some cases when false is |
41 // returned - in these cases it should not be used. | 42 // returned - in these cases it should not be used. |
42 // Exposed for testing only. | 43 // Exposed for testing only. |
43 bool GetFieldTrialInfo(FieldTrialFlags* flags); | 44 bool GetFieldTrialInfo(FieldTrialFlags* flags); |
44 | 45 |
45 // Given a FieldTrialFlags object, returns the string value of the provided | 46 // Given a FieldTrialFlags object, returns the string value of the provided |
46 // flag. | 47 // flag. |
47 // Exposed for testing only. | 48 // Exposed for testing only. |
48 std::string GetStringValueForFlagWithDefault(const std::string& flag, | 49 std::string GetStringValueForFlagWithDefault(const std::string& flag, |
49 const std::string& default_value, | 50 const std::string& default_value, |
50 const FieldTrialFlags& flags); | 51 const FieldTrialFlags& flags); |
51 | 52 |
52 // Given a FieldTrialFlags object, returns the uint64 value of the provided | 53 // Given a FieldTrialFlags object, returns the uint64_t value of the provided |
53 // flag. | 54 // flag. |
54 // Exposed for testing only. | 55 // Exposed for testing only. |
55 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, | 56 uint64_t GetUInt64ValueForFlagWithDefault(const std::string& flag, |
56 uint64 default_value, | 57 uint64_t default_value, |
57 const FieldTrialFlags& flags); | 58 const FieldTrialFlags& flags); |
58 | 59 |
59 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 60 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
60 // Exposed for testing only. | 61 // Exposed for testing only. |
61 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 62 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
62 bool default_value, | 63 bool default_value, |
63 const FieldTrialFlags& flags); | 64 const FieldTrialFlags& flags); |
64 | 65 |
65 // Returns a string indicating whether InstantExtended is enabled, suitable | 66 // Returns a string indicating whether InstantExtended is enabled, suitable |
66 // for adding as a query string param to the homepage or search requests. | 67 // for adding as a query string param to the homepage or search requests. |
67 // Returns an empty string otherwise. | 68 // Returns an empty string otherwise. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // ----------------------------------------------------- | 105 // ----------------------------------------------------- |
105 // The following APIs are exposed for use in tests only. | 106 // The following APIs are exposed for use in tests only. |
106 // ----------------------------------------------------- | 107 // ----------------------------------------------------- |
107 | 108 |
108 // Forces query in the omnibox to be on for tests. | 109 // Forces query in the omnibox to be on for tests. |
109 void EnableQueryExtractionForTesting(); | 110 void EnableQueryExtractionForTesting(); |
110 | 111 |
111 } // namespace search | 112 } // namespace search |
112 | 113 |
113 #endif // COMPONENTS_SEARCH_SEARCH_H_ | 114 #endif // COMPONENTS_SEARCH_SEARCH_H_ |
OLD | NEW |