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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) | 306 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) |
307 return false; | 307 return false; |
308 if (cl->HasSwitch(switches::kEnableAnswersInSuggest)) | 308 if (cl->HasSwitch(switches::kEnableAnswersInSuggest)) |
309 return true; | 309 return true; |
310 | 310 |
311 return variations::GetVariationParamValue( | 311 return variations::GetVariationParamValue( |
312 kBundledExperimentFieldTrialName, | 312 kBundledExperimentFieldTrialName, |
313 kAnswersInSuggestRule) == "true"; | 313 kAnswersInSuggestRule) == "true"; |
314 } | 314 } |
315 | 315 |
316 bool OmniboxFieldTrial::DisplayHintTextWhenPossible() { | |
317 return variations::GetVariationParamValue( | |
318 kBundledExperimentFieldTrialName, | |
319 kDisplayHintTextWhenPossibleRule) == "true"; | |
320 } | |
321 | |
322 bool OmniboxFieldTrial::DisableResultsCaching() { | 316 bool OmniboxFieldTrial::DisableResultsCaching() { |
323 return variations::GetVariationParamValue( | 317 return variations::GetVariationParamValue( |
324 kBundledExperimentFieldTrialName, | 318 kBundledExperimentFieldTrialName, |
325 kDisableResultsCachingRule) == "true"; | 319 kDisableResultsCachingRule) == "true"; |
326 } | 320 } |
327 | 321 |
328 void OmniboxFieldTrial::GetSuggestPollingStrategy(bool* from_last_keystroke, | 322 void OmniboxFieldTrial::GetSuggestPollingStrategy(bool* from_last_keystroke, |
329 int* polling_delay_ms) { | 323 int* polling_delay_ms) { |
330 *from_last_keystroke = variations::GetVariationParamValue( | 324 *from_last_keystroke = variations::GetVariationParamValue( |
331 kBundledExperimentFieldTrialName, | 325 kBundledExperimentFieldTrialName, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; | 392 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; |
399 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; | 393 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; |
400 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = | 394 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = |
401 "HQPBookmarkValue"; | 395 "HQPBookmarkValue"; |
402 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; | 396 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; |
403 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = | 397 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = |
404 "HQPAllowMatchInScheme"; | 398 "HQPAllowMatchInScheme"; |
405 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; | 399 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; |
406 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; | 400 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; |
407 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; | 401 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; |
408 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = | |
409 "DisplayHintTextWhenPossible"; | |
410 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = | 402 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = |
411 "DisableResultsCaching"; | 403 "DisableResultsCaching"; |
412 const char | 404 const char |
413 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = | 405 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = |
414 "MeasureSuggestPollingDelayFromLastKeystroke"; | 406 "MeasureSuggestPollingDelayFromLastKeystroke"; |
415 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = | 407 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = |
416 "SuggestPollingDelayMs"; | 408 "SuggestPollingDelayMs"; |
417 const char OmniboxFieldTrial::kHQPFixFrequencyScoringBugsRule[] = | 409 const char OmniboxFieldTrial::kHQPFixFrequencyScoringBugsRule[] = |
418 "HQPFixFrequencyScoringBugs"; | 410 "HQPFixFrequencyScoringBugs"; |
419 const char OmniboxFieldTrial::kHQPNumTitleWordsRule[] = "HQPNumTitleWords"; | 411 const char OmniboxFieldTrial::kHQPNumTitleWordsRule[] = "HQPNumTitleWords"; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 if (it != params.end()) | 491 if (it != params.end()) |
500 return it->second; | 492 return it->second; |
501 // Fall back to the global instant extended context. | 493 // Fall back to the global instant extended context. |
502 it = params.find(rule + ":" + page_classification_str + ":*"); | 494 it = params.find(rule + ":" + page_classification_str + ":*"); |
503 if (it != params.end()) | 495 if (it != params.end()) |
504 return it->second; | 496 return it->second; |
505 // Look up rule in the global context. | 497 // Look up rule in the global context. |
506 it = params.find(rule + ":*:*"); | 498 it = params.find(rule + ":*:*"); |
507 return (it != params.end()) ? it->second : std::string(); | 499 return (it != params.end()) ? it->second : std::string(); |
508 } | 500 } |
OLD | NEW |