| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 InstantSupportState GetInstantSupportStateFromNavigationEntry( | 190 InstantSupportState GetInstantSupportStateFromNavigationEntry( |
| 191 const content::NavigationEntry& entry); | 191 const content::NavigationEntry& entry); |
| 192 | 192 |
| 193 // Returns true if the field trial flag is enabled to prefetch results on SRP. | 193 // Returns true if the field trial flag is enabled to prefetch results on SRP. |
| 194 bool ShouldPrefetchSearchResultsOnSRP(); | 194 bool ShouldPrefetchSearchResultsOnSRP(); |
| 195 | 195 |
| 196 // ----------------------------------------------------- | 196 // ----------------------------------------------------- |
| 197 // The following APIs are exposed for use in tests only. | 197 // The following APIs are exposed for use in tests only. |
| 198 // ----------------------------------------------------- | 198 // ----------------------------------------------------- |
| 199 | 199 |
| 200 // Forces the Instant Extended API to be enabled for tests. | 200 // Forces query in the omnibox to be enabled for tests. |
| 201 void EnableInstantExtendedAPIForTesting(); | 201 void EnableQueryExtractionForTesting(); |
| 202 | |
| 203 // Forces the Instant Extended API to be disabled for tests. | |
| 204 void DisableInstantExtendedAPIForTesting(); | |
| 205 | 202 |
| 206 // Type for a collection of experiment configuration parameters. | 203 // Type for a collection of experiment configuration parameters. |
| 207 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; | 204 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; |
| 208 | 205 |
| 209 // Finds the active field trial group name and parses out the group number and | 206 // Finds the active field trial group name and parses out the configuration |
| 210 // configuration flags. On success, |flags| will be filled with the field trial | 207 // flags. On success, |flags| will be filled with the field trial flags. |flags| |
| 211 // flags. |flags| must not be NULL. If not NULL, |group_number| will receive the | 208 // must not be NULL. Returns true iff the active field trial is successfully |
| 212 // experiment group number. | 209 // parsed and not disabled. |
| 213 // Returns true iff the active field trial is successfully parsed and not | |
| 214 // disabled. | |
| 215 // Note that |flags| may be successfully populated in some cases when false is | 210 // Note that |flags| may be successfully populated in some cases when false is |
| 216 // returned - in these cases it should not be used. | 211 // returned - in these cases it should not be used. |
| 217 // Exposed for testing only. | 212 // Exposed for testing only. |
| 218 bool GetFieldTrialInfo(FieldTrialFlags* flags, | 213 bool GetFieldTrialInfo(FieldTrialFlags* flags); |
| 219 uint64* group_number); | |
| 220 | 214 |
| 221 // Given a FieldTrialFlags object, returns the string value of the provided | 215 // Given a FieldTrialFlags object, returns the string value of the provided |
| 222 // flag. | 216 // flag. |
| 223 // Exposed for testing only. | 217 // Exposed for testing only. |
| 224 std::string GetStringValueForFlagWithDefault(const std::string& flag, | 218 std::string GetStringValueForFlagWithDefault(const std::string& flag, |
| 225 const std::string& default_value, | 219 const std::string& default_value, |
| 226 const FieldTrialFlags& flags); | 220 const FieldTrialFlags& flags); |
| 227 | 221 |
| 228 // Given a FieldTrialFlags object, returns the uint64 value of the provided | 222 // Given a FieldTrialFlags object, returns the uint64 value of the provided |
| 229 // flag. | 223 // flag. |
| 230 // Exposed for testing only. | 224 // Exposed for testing only. |
| 231 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, | 225 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, |
| 232 uint64 default_value, | 226 uint64 default_value, |
| 233 const FieldTrialFlags& flags); | 227 const FieldTrialFlags& flags); |
| 234 | 228 |
| 235 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 229 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
| 236 // Exposed for testing only. | 230 // Exposed for testing only. |
| 237 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 231 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 238 bool default_value, | 232 bool default_value, |
| 239 const FieldTrialFlags& flags); | 233 const FieldTrialFlags& flags); |
| 240 | 234 |
| 241 // Returns the Cacheable New Tab Page URL for the given |profile|. | 235 // Returns the Cacheable New Tab Page URL for the given |profile|. |
| 242 GURL GetNewTabPageURL(Profile* profile); | 236 GURL GetNewTabPageURL(Profile* profile); |
| 243 | 237 |
| 244 // Let tests reset the gate that prevents metrics from being sent more than | |
| 245 // once. | |
| 246 void ResetInstantExtendedOptInStateGateForTest(); | |
| 247 | |
| 248 } // namespace chrome | 238 } // namespace chrome |
| 249 | 239 |
| 250 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 240 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
| OLD | NEW |