Chromium Code Reviews| Index: chrome/browser/omnibox/omnibox_field_trial.cc |
| diff --git a/chrome/browser/omnibox/omnibox_field_trial.cc b/chrome/browser/omnibox/omnibox_field_trial.cc |
| index e2c7144101483c2a6f0528524ec7d2854d086458..90caffb98140b2667d932d1433bfe2d9f3bf6e67 100644 |
| --- a/chrome/browser/omnibox/omnibox_field_trial.cc |
| +++ b/chrome/browser/omnibox/omnibox_field_trial.cc |
| @@ -265,6 +265,27 @@ void OmniboxFieldTrial::GetDemotionsByType( |
| } |
| } |
| +void OmniboxFieldTrial::GetUndemotableTopTypes( |
| + AutocompleteInput::PageClassification current_page_classification, |
| + UndemotableTopMatchTypes* undemotable_types) { |
| + undemotable_types->clear(); |
| + const std::string types_rule = |
| + OmniboxFieldTrial::GetValueForRuleInContext( |
| + kUndemotableTopTypeRule, |
| + current_page_classification); |
| + std::vector<std::string> types; |
|
Mark P
2013/11/04 18:47:56
Please explicitly comment on the format for the va
H Fung
2013/11/04 19:44:08
Done.
|
| + base::SplitString(types_rule, ',', &types); |
| + for (std::vector<std::string>::const_iterator it = types.begin(); |
| + it != types.end(); ++it) { |
| + // This is a best-effort conversion; we trust the hand-crafted parameters |
| + // downloaded from the server to be perfect. There's no need for handle |
| + // errors smartly. |
| + int t; |
| + base::StringToInt(*it, &t); |
| + undemotable_types->insert(static_cast<AutocompleteMatchType::Type>(t)); |
| + } |
| +} |
| + |
| bool OmniboxFieldTrial::ReorderForLegalDefaultMatch( |
| AutocompleteInput::PageClassification current_page_classification) { |
| return OmniboxFieldTrial::GetValueForRuleInContext( |
| @@ -278,6 +299,7 @@ const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = |
| "ShortcutsScoringMaxRelevance"; |
| const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; |
| const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; |
| +const char OmniboxFieldTrial::kUndemotableTopTypeRule[] = "UndemotableTopTypes"; |
| const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRule[] = |
| "ReorderForLegalDefaultMatch"; |
| const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleEnabled[] = |