Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: chrome/browser/omnibox/omnibox_field_trial.cc

Issue 67553002: Omnibox Field Trial: Make HQP Score Bookmarks More Highly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/omnibox/omnibox_field_trial.h" 5 #include "chrome/browser/omnibox/omnibox_field_trial.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 } 266 }
267 267
268 bool OmniboxFieldTrial::ReorderForLegalDefaultMatch( 268 bool OmniboxFieldTrial::ReorderForLegalDefaultMatch(
269 AutocompleteInput::PageClassification current_page_classification) { 269 AutocompleteInput::PageClassification current_page_classification) {
270 return OmniboxFieldTrial::GetValueForRuleInContext( 270 return OmniboxFieldTrial::GetValueForRuleInContext(
271 kReorderForLegalDefaultMatchRule, current_page_classification) == 271 kReorderForLegalDefaultMatchRule, current_page_classification) ==
272 kReorderForLegalDefaultMatchRuleEnabled; 272 kReorderForLegalDefaultMatchRuleEnabled;
273 } 273 }
274 274
275 int OmniboxFieldTrial::HQPBookmarkValue() {
276 std::string bookmark_value_str = chrome_variations::
277 GetVariationParamValue(kBundledExperimentFieldTrialName,
278 kHQPBookmarkValueRule);
279 if (bookmark_value_str.empty())
280 return 1;
281 // This is a best-effort conversion; we trust the hand-crafted parameters
282 // downloaded from the server to be perfect. There's no need for handle
283 // errors smartly.
284 int bookmark_value;
285 base::StringToInt(bookmark_value_str, &bookmark_value);
286 return bookmark_value;
287 }
288
275 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = 289 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] =
276 "OmniboxBundledExperimentV1"; 290 "OmniboxBundledExperimentV1";
277 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = 291 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] =
278 "ShortcutsScoringMaxRelevance"; 292 "ShortcutsScoringMaxRelevance";
279 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; 293 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory";
280 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; 294 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType";
281 const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRule[] = 295 const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRule[] =
282 "ReorderForLegalDefaultMatch"; 296 "ReorderForLegalDefaultMatch";
297 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] =
298 "HQPBookmarkValue";
283 const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleEnabled[] = 299 const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleEnabled[] =
284 "ReorderForLegalDefaultMatch"; 300 "ReorderForLegalDefaultMatch";
285 301
286 // Background and implementation details: 302 // Background and implementation details:
287 // 303 //
288 // Each experiment group in any field trial can come with an optional set of 304 // Each experiment group in any field trial can come with an optional set of
289 // parameters (key-value pairs). In the bundled omnibox experiment 305 // parameters (key-value pairs). In the bundled omnibox experiment
290 // (kBundledExperimentFieldTrialName), each experiment group comes with a 306 // (kBundledExperimentFieldTrialName), each experiment group comes with a
291 // list of parameters in the form: 307 // list of parameters in the form:
292 // key=<Rule>: 308 // key=<Rule>:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (it != params.end()) 354 if (it != params.end())
339 return it->second; 355 return it->second;
340 // Fall back to the global instant extended context. 356 // Fall back to the global instant extended context.
341 it = params.find(rule + ":" + page_classification_str + ":*"); 357 it = params.find(rule + ":" + page_classification_str + ":*");
342 if (it != params.end()) 358 if (it != params.end())
343 return it->second; 359 return it->second;
344 // Look up rule in the global context. 360 // Look up rule in the global context.
345 it = params.find(rule + ":*:*"); 361 it = params.find(rule + ":*:*");
346 return (it != params.end()) ? it->second : std::string(); 362 return (it != params.end()) ? it->second : std::string();
347 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698