Chromium Code Reviews| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 kBundledExperimentFieldTrialName, | 329 kBundledExperimentFieldTrialName, |
| 330 kAddUWYTMatchEvenIfPromotedURLsRule) == "true"; | 330 kAddUWYTMatchEvenIfPromotedURLsRule) == "true"; |
| 331 } | 331 } |
| 332 | 332 |
| 333 bool OmniboxFieldTrial::DisplayHintTextWhenPossible() { | 333 bool OmniboxFieldTrial::DisplayHintTextWhenPossible() { |
| 334 return variations::GetVariationParamValue( | 334 return variations::GetVariationParamValue( |
| 335 kBundledExperimentFieldTrialName, | 335 kBundledExperimentFieldTrialName, |
| 336 kDisplayHintTextWhenPossibleRule) == "true"; | 336 kDisplayHintTextWhenPossibleRule) == "true"; |
| 337 } | 337 } |
| 338 | 338 |
| 339 bool OmniboxFieldTrial::DisableResultsCaching() { | |
| 340 return variations::GetVariationParamValue( | |
| 341 kBundledExperimentFieldTrialName, | |
| 342 kDisableResultsCachingRule) == "true"; | |
| 343 } | |
| 344 | |
| 345 void OmniboxFieldTrial::GetSuggestPollingStrategy(bool* since_the_last_request, | |
| 346 int* polling_delay_ms) { | |
| 347 *since_the_last_request = variations::GetVariationParamValue( | |
| 348 kBundledExperimentFieldTrialName, | |
| 349 kSuggestPollingDelaySinceTheLastRequestRule) == "true"; | |
|
H Fung
2014/10/20 21:59:42
I'm not sure if you want to have a flag to take in
Bart N.
2014/10/22 01:19:08
I think I'd prefer to stay with the current rule,
| |
| 350 | |
| 351 const std::string& polling_delay_string = variations::GetVariationParamValue( | |
| 352 kBundledExperimentFieldTrialName, | |
| 353 kSuggestPollingDelayMsRule); | |
| 354 if (polling_delay_string.empty() || | |
| 355 !base::StringToInt(polling_delay_string, polling_delay_ms) || | |
| 356 *polling_delay_ms <= 0) { | |
|
Mark P
2014/10/21 21:28:22
nit: parans around binary operator <=
Bart N.
2014/10/22 01:19:07
Done.
| |
| 357 // Status Quo (100ms since the last suggest request). | |
|
Mark P
2014/10/21 21:28:22
This comment is helpful for reviewers. For the co
Bart N.
2014/10/22 01:19:08
Done.
| |
| 358 *polling_delay_ms = 100; | |
| 359 } | |
| 360 } | |
| 361 | |
| 339 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = | 362 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = |
| 340 "OmniboxBundledExperimentV1"; | 363 "OmniboxBundledExperimentV1"; |
| 341 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = | 364 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = |
| 342 "ShortcutsScoringMaxRelevance"; | 365 "ShortcutsScoringMaxRelevance"; |
| 343 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; | 366 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; |
| 344 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; | 367 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; |
| 345 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = | 368 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = |
| 346 "HQPBookmarkValue"; | 369 "HQPBookmarkValue"; |
| 347 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; | 370 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; |
| 348 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = | 371 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = |
| 349 "HQPAllowMatchInScheme"; | 372 "HQPAllowMatchInScheme"; |
| 350 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; | 373 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; |
| 351 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; | 374 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; |
| 352 const char OmniboxFieldTrial::kDisableInliningRule[] = "DisableInlining"; | 375 const char OmniboxFieldTrial::kDisableInliningRule[] = "DisableInlining"; |
| 353 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; | 376 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; |
| 354 const char OmniboxFieldTrial::kAddUWYTMatchEvenIfPromotedURLsRule[] = | 377 const char OmniboxFieldTrial::kAddUWYTMatchEvenIfPromotedURLsRule[] = |
| 355 "AddUWYTMatchEvenIfPromotedURLs"; | 378 "AddUWYTMatchEvenIfPromotedURLs"; |
| 356 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = | 379 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = |
| 357 "DisplayHintTextWhenPossible"; | 380 "DisplayHintTextWhenPossible"; |
| 381 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = | |
| 382 "DisableResultsCaching"; | |
| 383 const char OmniboxFieldTrial::kSuggestPollingDelaySinceTheLastRequestRule[] = | |
| 384 "SuggestPollingDelaySinceTheLastRequest"; | |
|
Mark P
2014/10/21 21:28:22
If you change the name of the rule, please revise
Bart N.
2014/10/22 01:19:08
Done.
| |
| 385 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = | |
|
H Fung
2014/10/20 21:59:42
This is a param, not a rule?
Mark P
2014/10/21 21:28:22
It's a "rule". In this file, rule correspond to t
Bart N.
2014/10/22 01:19:08
Acknowledged.
Bart N.
2014/10/22 01:19:08
Acknowledged.
| |
| 386 "SuggestPollingDelayMs"; | |
| 358 | 387 |
| 359 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = | 388 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = |
| 360 "HUPExperimentalScoringEnabled"; | 389 "HUPExperimentalScoringEnabled"; |
| 361 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = | 390 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = |
| 362 "TypedCountRelevanceCap"; | 391 "TypedCountRelevanceCap"; |
| 363 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] = | 392 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] = |
| 364 "TypedCountHalfLifeTime"; | 393 "TypedCountHalfLifeTime"; |
| 365 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] = | 394 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] = |
| 366 "TypedCountScoreBuckets"; | 395 "TypedCountScoreBuckets"; |
| 367 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = | 396 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 if (it != params.end()) | 455 if (it != params.end()) |
| 427 return it->second; | 456 return it->second; |
| 428 // Fall back to the global instant extended context. | 457 // Fall back to the global instant extended context. |
| 429 it = params.find(rule + ":" + page_classification_str + ":*"); | 458 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 430 if (it != params.end()) | 459 if (it != params.end()) |
| 431 return it->second; | 460 return it->second; |
| 432 // Look up rule in the global context. | 461 // Look up rule in the global context. |
| 433 it = params.find(rule + ":*:*"); | 462 it = params.find(rule + ":*:*"); |
| 434 return (it != params.end()) ? it->second : std::string(); | 463 return (it != params.end()) ? it->second : std::string(); |
| 435 } | 464 } |
| OLD | NEW |