| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Exposed for testing. | 133 // Exposed for testing. |
| 134 bool ShouldUseCacheableNTP(); | 134 bool ShouldUseCacheableNTP(); |
| 135 | 135 |
| 136 // Returns true if the Instant NTP should be shown and false if not. | 136 // Returns true if the Instant NTP should be shown and false if not. |
| 137 bool ShouldShowInstantNTP(); | 137 bool ShouldShowInstantNTP(); |
| 138 | 138 |
| 139 // Returns true if the recent tabs link should be shown on the local NTP in | 139 // Returns true if the recent tabs link should be shown on the local NTP in |
| 140 // field trials. | 140 // field trials. |
| 141 bool ShouldShowRecentTabsOnNTP(); | 141 bool ShouldShowRecentTabsOnNTP(); |
| 142 | 142 |
| 143 // Returns true if Instant Extended should be disabled on the search results | |
| 144 // page. | |
| 145 bool ShouldSuppressInstantExtendedOnSRP(); | |
| 146 | |
| 147 // Transforms the input |url| into its "effective URL". The returned URL | 143 // Transforms the input |url| into its "effective URL". The returned URL |
| 148 // facilitates grouping process-per-site. The |url| is transformed, for | 144 // facilitates grouping process-per-site. The |url| is transformed, for |
| 149 // example, from | 145 // example, from |
| 150 // | 146 // |
| 151 // https://www.google.com/search?espv=1&q=tractors | 147 // https://www.google.com/search?espv=1&q=tractors |
| 152 // | 148 // |
| 153 // to the privileged URL | 149 // to the privileged URL |
| 154 // | 150 // |
| 155 // chrome-search://www.google.com/search?espv=1&q=tractors | 151 // chrome-search://www.google.com/search?espv=1&q=tractors |
| 156 // | 152 // |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 InstantSupportState GetInstantSupportStateFromNavigationEntry( | 186 InstantSupportState GetInstantSupportStateFromNavigationEntry( |
| 191 const content::NavigationEntry& entry); | 187 const content::NavigationEntry& entry); |
| 192 | 188 |
| 193 // Returns true if the field trial flag is enabled to prefetch results on SRP. | 189 // Returns true if the field trial flag is enabled to prefetch results on SRP. |
| 194 bool ShouldPrefetchSearchResultsOnSRP(); | 190 bool ShouldPrefetchSearchResultsOnSRP(); |
| 195 | 191 |
| 196 // ----------------------------------------------------- | 192 // ----------------------------------------------------- |
| 197 // The following APIs are exposed for use in tests only. | 193 // The following APIs are exposed for use in tests only. |
| 198 // ----------------------------------------------------- | 194 // ----------------------------------------------------- |
| 199 | 195 |
| 200 // Forces the Instant Extended API to be enabled for tests. | 196 // Forces query in the omnibox to be enabled for tests. |
| 201 void EnableInstantExtendedAPIForTesting(); | 197 void EnableQueryExtractionForTesting(); |
| 202 | |
| 203 // Forces the Instant Extended API to be disabled for tests. | |
| 204 void DisableInstantExtendedAPIForTesting(); | |
| 205 | 198 |
| 206 // Type for a collection of experiment configuration parameters. | 199 // Type for a collection of experiment configuration parameters. |
| 207 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; | 200 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; |
| 208 | 201 |
| 209 // Finds the active field trial group name and parses out the group number and | 202 // 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 | 203 // 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 | 204 // must not be NULL. Returns true iff the active field trial is successfully |
| 212 // experiment group number. | 205 // 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 | 206 // Note that |flags| may be successfully populated in some cases when false is |
| 216 // returned - in these cases it should not be used. | 207 // returned - in these cases it should not be used. |
| 217 // Exposed for testing only. | 208 // Exposed for testing only. |
| 218 bool GetFieldTrialInfo(FieldTrialFlags* flags, | 209 bool GetFieldTrialInfo(FieldTrialFlags* flags); |
| 219 uint64* group_number); | |
| 220 | 210 |
| 221 // Given a FieldTrialFlags object, returns the string value of the provided | 211 // Given a FieldTrialFlags object, returns the string value of the provided |
| 222 // flag. | 212 // flag. |
| 223 // Exposed for testing only. | 213 // Exposed for testing only. |
| 224 std::string GetStringValueForFlagWithDefault(const std::string& flag, | 214 std::string GetStringValueForFlagWithDefault(const std::string& flag, |
| 225 const std::string& default_value, | 215 const std::string& default_value, |
| 226 const FieldTrialFlags& flags); | 216 const FieldTrialFlags& flags); |
| 227 | 217 |
| 228 // Given a FieldTrialFlags object, returns the uint64 value of the provided | 218 // Given a FieldTrialFlags object, returns the uint64 value of the provided |
| 229 // flag. | 219 // flag. |
| 230 // Exposed for testing only. | 220 // Exposed for testing only. |
| 231 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, | 221 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, |
| 232 uint64 default_value, | 222 uint64 default_value, |
| 233 const FieldTrialFlags& flags); | 223 const FieldTrialFlags& flags); |
| 234 | 224 |
| 235 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 225 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
| 236 // Exposed for testing only. | 226 // Exposed for testing only. |
| 237 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 227 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 238 bool default_value, | 228 bool default_value, |
| 239 const FieldTrialFlags& flags); | 229 const FieldTrialFlags& flags); |
| 240 | 230 |
| 241 // Returns the Cacheable New Tab Page URL for the given |profile|. | 231 // Returns the Cacheable New Tab Page URL for the given |profile|. |
| 242 GURL GetNewTabPageURL(Profile* profile); | 232 GURL GetNewTabPageURL(Profile* profile); |
| 243 | 233 |
| 244 // Let tests reset the gate that prevents metrics from being sent more than | |
| 245 // once. | |
| 246 void ResetInstantExtendedOptInStateGateForTest(); | |
| 247 | |
| 248 } // namespace chrome | 234 } // namespace chrome |
| 249 | 235 |
| 250 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 236 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
| OLD | NEW |