| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // Exposed for testing. | 154 // Exposed for testing. |
| 155 bool ShouldUseCacheableNTP(); | 155 bool ShouldUseCacheableNTP(); |
| 156 | 156 |
| 157 // Returns true if the Instant NTP should be shown and false if not. | 157 // Returns true if the Instant NTP should be shown and false if not. |
| 158 bool ShouldShowInstantNTP(); | 158 bool ShouldShowInstantNTP(); |
| 159 | 159 |
| 160 // Returns true if the recent tabs link should be shown on the local NTP in | 160 // Returns true if the recent tabs link should be shown on the local NTP in |
| 161 // field trials. | 161 // field trials. |
| 162 bool ShouldShowRecentTabsOnNTP(); | 162 bool ShouldShowRecentTabsOnNTP(); |
| 163 | 163 |
| 164 // Returns true if Instant Extended should be disabled on the search results | |
| 165 // page. | |
| 166 bool ShouldSuppressInstantExtendedOnSRP(); | |
| 167 | |
| 168 // Returns when we should show a search button in the omnibox. This may be any | 164 // Returns when we should show a search button in the omnibox. This may be any |
| 169 // of several values, some of which depend on whether the underlying state of | 165 // of several values, some of which depend on whether the underlying state of |
| 170 // the page would normally be to perform search term replacement; see also | 166 // the page would normally be to perform search term replacement; see also |
| 171 // ToolbarModel::WouldPerformSearchTermReplacement(). | 167 // ToolbarModel::WouldPerformSearchTermReplacement(). |
| 172 DisplaySearchButtonConditions GetDisplaySearchButtonConditions(); | 168 DisplaySearchButtonConditions GetDisplaySearchButtonConditions(); |
| 173 | 169 |
| 174 // Returns true if the origin chip should be shown next to the omnibox. This | 170 // Returns true if the origin chip should be shown next to the omnibox. This |
| 175 // also includes the related changes to the omnibox. | 171 // also includes the related changes to the omnibox. |
| 176 bool ShouldDisplayOriginChip(); | 172 bool ShouldDisplayOriginChip(); |
| 177 | 173 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 InstantSupportState GetInstantSupportStateFromNavigationEntry( | 217 InstantSupportState GetInstantSupportStateFromNavigationEntry( |
| 222 const content::NavigationEntry& entry); | 218 const content::NavigationEntry& entry); |
| 223 | 219 |
| 224 // Returns true if the field trial flag is enabled to prefetch results on SRP. | 220 // Returns true if the field trial flag is enabled to prefetch results on SRP. |
| 225 bool ShouldPrefetchSearchResultsOnSRP(); | 221 bool ShouldPrefetchSearchResultsOnSRP(); |
| 226 | 222 |
| 227 // ----------------------------------------------------- | 223 // ----------------------------------------------------- |
| 228 // The following APIs are exposed for use in tests only. | 224 // The following APIs are exposed for use in tests only. |
| 229 // ----------------------------------------------------- | 225 // ----------------------------------------------------- |
| 230 | 226 |
| 231 // Forces the Instant Extended API to be enabled for tests. | 227 // Forces query in the omnibox to be enabled for tests. |
| 232 void EnableInstantExtendedAPIForTesting(); | 228 void EnableQueryExtractionForTesting(); |
| 233 | |
| 234 // Forces the Instant Extended API to be disabled for tests. | |
| 235 void DisableInstantExtendedAPIForTesting(); | |
| 236 | 229 |
| 237 // Type for a collection of experiment configuration parameters. | 230 // Type for a collection of experiment configuration parameters. |
| 238 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; | 231 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; |
| 239 | 232 |
| 240 // Finds the active field trial group name and parses out the group number and | 233 // Finds the active field trial group name and parses out the configuration |
| 241 // configuration flags. On success, |flags| will be filled with the field trial | 234 // flags. On success, |flags| will be filled with the field trial flags. |flags| |
| 242 // flags. |flags| must not be NULL. If not NULL, |group_number| will receive the | 235 // must not be NULL. Returns true iff the active field trial is successfully |
| 243 // experiment group number. | 236 // parsed and not disabled. |
| 244 // Returns true iff the active field trial is successfully parsed and not | |
| 245 // disabled. | |
| 246 // Note that |flags| may be successfully populated in some cases when false is | 237 // Note that |flags| may be successfully populated in some cases when false is |
| 247 // returned - in these cases it should not be used. | 238 // returned - in these cases it should not be used. |
| 248 // Exposed for testing only. | 239 // Exposed for testing only. |
| 249 bool GetFieldTrialInfo(FieldTrialFlags* flags, | 240 bool GetFieldTrialInfo(FieldTrialFlags* flags); |
| 250 uint64* group_number); | |
| 251 | 241 |
| 252 // Given a FieldTrialFlags object, returns the string value of the provided | 242 // Given a FieldTrialFlags object, returns the string value of the provided |
| 253 // flag. | 243 // flag. |
| 254 // Exposed for testing only. | 244 // Exposed for testing only. |
| 255 std::string GetStringValueForFlagWithDefault(const std::string& flag, | 245 std::string GetStringValueForFlagWithDefault(const std::string& flag, |
| 256 const std::string& default_value, | 246 const std::string& default_value, |
| 257 const FieldTrialFlags& flags); | 247 const FieldTrialFlags& flags); |
| 258 | 248 |
| 259 // Given a FieldTrialFlags object, returns the uint64 value of the provided | 249 // Given a FieldTrialFlags object, returns the uint64 value of the provided |
| 260 // flag. | 250 // flag. |
| 261 // Exposed for testing only. | 251 // Exposed for testing only. |
| 262 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, | 252 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, |
| 263 uint64 default_value, | 253 uint64 default_value, |
| 264 const FieldTrialFlags& flags); | 254 const FieldTrialFlags& flags); |
| 265 | 255 |
| 266 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 256 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
| 267 // Exposed for testing only. | 257 // Exposed for testing only. |
| 268 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 258 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 269 bool default_value, | 259 bool default_value, |
| 270 const FieldTrialFlags& flags); | 260 const FieldTrialFlags& flags); |
| 271 | 261 |
| 272 // Returns the Cacheable New Tab Page URL for the given |profile|. | 262 // Returns the Cacheable New Tab Page URL for the given |profile|. |
| 273 GURL GetNewTabPageURL(Profile* profile); | 263 GURL GetNewTabPageURL(Profile* profile); |
| 274 | 264 |
| 275 // Let tests reset the gate that prevents metrics from being sent more than | |
| 276 // once. | |
| 277 void ResetInstantExtendedOptInStateGateForTest(); | |
| 278 | |
| 279 } // namespace chrome | 265 } // namespace chrome |
| 280 | 266 |
| 281 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 267 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
| OLD | NEW |