| 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 #include "components/omnibox/omnibox_field_trial.h" | 5 #include "components/omnibox/omnibox_field_trial.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 kBundledExperimentFieldTrialName, | 294 kBundledExperimentFieldTrialName, |
| 295 kHQPAllowMatchInTLDRule) == "true"; | 295 kHQPAllowMatchInTLDRule) == "true"; |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() { | 298 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() { |
| 299 return variations::GetVariationParamValue( | 299 return variations::GetVariationParamValue( |
| 300 kBundledExperimentFieldTrialName, | 300 kBundledExperimentFieldTrialName, |
| 301 kHQPAllowMatchInSchemeRule) == "true"; | 301 kHQPAllowMatchInSchemeRule) == "true"; |
| 302 } | 302 } |
| 303 | 303 |
| 304 bool OmniboxFieldTrial::DisableInlining() { | |
| 305 return variations::GetVariationParamValue( | |
| 306 kBundledExperimentFieldTrialName, | |
| 307 kDisableInliningRule) == "true"; | |
| 308 } | |
| 309 | |
| 310 bool OmniboxFieldTrial::EnableAnswersInSuggest() { | 304 bool OmniboxFieldTrial::EnableAnswersInSuggest() { |
| 311 const base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); | 305 const base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
| 312 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) | 306 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) |
| 313 return false; | 307 return false; |
| 314 if (cl->HasSwitch(switches::kEnableAnswersInSuggest)) | 308 if (cl->HasSwitch(switches::kEnableAnswersInSuggest)) |
| 315 return true; | 309 return true; |
| 316 | 310 |
| 317 return variations::GetVariationParamValue( | 311 return variations::GetVariationParamValue( |
| 318 kBundledExperimentFieldTrialName, | 312 kBundledExperimentFieldTrialName, |
| 319 kAnswersInSuggestRule) == "true"; | 313 kAnswersInSuggestRule) == "true"; |
| 320 } | 314 } |
| 321 | 315 |
| 322 bool OmniboxFieldTrial::AddUWYTMatchEvenIfPromotedURLs() { | |
| 323 return variations::GetVariationParamValue( | |
| 324 kBundledExperimentFieldTrialName, | |
| 325 kAddUWYTMatchEvenIfPromotedURLsRule) == "true"; | |
| 326 } | |
| 327 | |
| 328 bool OmniboxFieldTrial::DisplayHintTextWhenPossible() { | 316 bool OmniboxFieldTrial::DisplayHintTextWhenPossible() { |
| 329 return variations::GetVariationParamValue( | 317 return variations::GetVariationParamValue( |
| 330 kBundledExperimentFieldTrialName, | 318 kBundledExperimentFieldTrialName, |
| 331 kDisplayHintTextWhenPossibleRule) == "true"; | 319 kDisplayHintTextWhenPossibleRule) == "true"; |
| 332 } | 320 } |
| 333 | 321 |
| 334 bool OmniboxFieldTrial::DisableResultsCaching() { | 322 bool OmniboxFieldTrial::DisableResultsCaching() { |
| 335 return variations::GetVariationParamValue( | 323 return variations::GetVariationParamValue( |
| 336 kBundledExperimentFieldTrialName, | 324 kBundledExperimentFieldTrialName, |
| 337 kDisableResultsCachingRule) == "true"; | 325 kDisableResultsCachingRule) == "true"; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 360 "ShortcutsScoringMaxRelevance"; | 348 "ShortcutsScoringMaxRelevance"; |
| 361 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; | 349 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; |
| 362 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; | 350 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; |
| 363 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = | 351 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = |
| 364 "HQPBookmarkValue"; | 352 "HQPBookmarkValue"; |
| 365 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; | 353 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; |
| 366 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = | 354 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = |
| 367 "HQPAllowMatchInScheme"; | 355 "HQPAllowMatchInScheme"; |
| 368 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; | 356 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; |
| 369 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; | 357 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; |
| 370 const char OmniboxFieldTrial::kDisableInliningRule[] = "DisableInlining"; | |
| 371 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; | 358 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; |
| 372 const char OmniboxFieldTrial::kAddUWYTMatchEvenIfPromotedURLsRule[] = | |
| 373 "AddUWYTMatchEvenIfPromotedURLs"; | |
| 374 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = | 359 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = |
| 375 "DisplayHintTextWhenPossible"; | 360 "DisplayHintTextWhenPossible"; |
| 376 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = | 361 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = |
| 377 "DisableResultsCaching"; | 362 "DisableResultsCaching"; |
| 378 const char | 363 const char |
| 379 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = | 364 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = |
| 380 "MeasureSuggestPollingDelayFromLastKeystroke"; | 365 "MeasureSuggestPollingDelayFromLastKeystroke"; |
| 381 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = | 366 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = |
| 382 "SuggestPollingDelayMs"; | 367 "SuggestPollingDelayMs"; |
| 383 | 368 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 if (it != params.end()) | 439 if (it != params.end()) |
| 455 return it->second; | 440 return it->second; |
| 456 // Fall back to the global instant extended context. | 441 // Fall back to the global instant extended context. |
| 457 it = params.find(rule + ":" + page_classification_str + ":*"); | 442 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 458 if (it != params.end()) | 443 if (it != params.end()) |
| 459 return it->second; | 444 return it->second; |
| 460 // Look up rule in the global context. | 445 // Look up rule in the global context. |
| 461 it = params.find(rule + ":*:*"); | 446 it = params.find(rule + ":*:*"); |
| 462 return (it != params.end()) ? it->second : std::string(); | 447 return (it != params.end()) ? it->second : std::string(); |
| 463 } | 448 } |
| OLD | NEW |