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

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

Issue 2716273004: Invert description and URL for experimental zero suggest suggestions. (Closed)
Patch Set: Remove unnecessary function. Created 3 years, 9 months 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
« no previous file with comments | « components/omnibox/browser/omnibox_field_trial.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/omnibox_field_trial.h" 5 #include "components/omnibox/browser/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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // This is a best-effort conversion; we trust the hand-crafted parameters 532 // This is a best-effort conversion; we trust the hand-crafted parameters
533 // downloaded from the server to be perfect. There's no need for handle 533 // downloaded from the server to be perfect. There's no need for handle
534 // errors smartly. 534 // errors smartly.
535 int value; 535 int value;
536 base::StringToInt(value_str, &value); 536 base::StringToInt(value_str, &value);
537 return value; 537 return value;
538 } 538 }
539 539
540 OmniboxFieldTrial::EmphasizeTitlesCondition 540 OmniboxFieldTrial::EmphasizeTitlesCondition
541 OmniboxFieldTrial::GetEmphasizeTitlesConditionForInput( 541 OmniboxFieldTrial::GetEmphasizeTitlesConditionForInput(
542 metrics::OmniboxInputType::Type input_type) { 542 const AutocompleteInput& input) {
543 // Look up the parameter named kEmphasizeTitlesRule + ":" + input_type, 543 // First, check if we should emphasize titles for zero suggest suggestions.
544 if (input.from_omnibox_focus() &&
545 base::FeatureList::IsEnabled(features::kZeroSuggestSwapTitleAndUrl)) {
546 return EMPHASIZE_WHEN_NONEMPTY;
547 }
548 // Look up the parameter named kEmphasizeTitlesRule + ":" + input.type(),
544 // find its value, and return that value as an enum. If the parameter 549 // find its value, and return that value as an enum. If the parameter
545 // isn't redefined, fall back to the generic rule kEmphasizeTitlesRule + ":*" 550 // isn't redefined, fall back to the generic rule kEmphasizeTitlesRule + ":*"
546 std::string value_str(variations::GetVariationParamValue( 551 std::string value_str(variations::GetVariationParamValue(
547 kBundledExperimentFieldTrialName, 552 kBundledExperimentFieldTrialName,
548 std::string(kEmphasizeTitlesRule) + "_" + 553 std::string(kEmphasizeTitlesRule) + "_" +
549 base::IntToString(static_cast<int>(input_type)))); 554 base::IntToString(static_cast<int>(input.type()))));
550 if (value_str.empty()) { 555 if (value_str.empty()) {
551 value_str = variations::GetVariationParamValue( 556 value_str = variations::GetVariationParamValue(
552 kBundledExperimentFieldTrialName, 557 kBundledExperimentFieldTrialName,
553 std::string(kEmphasizeTitlesRule) + "_*"); 558 std::string(kEmphasizeTitlesRule) + "_*");
554 } 559 }
555 if (value_str.empty()) 560 if (value_str.empty())
556 return EMPHASIZE_NEVER; 561 return EMPHASIZE_NEVER;
557 // This is a best-effort conversion; we trust the hand-crafted parameters 562 // This is a best-effort conversion; we trust the hand-crafted parameters
558 // downloaded from the server to be perfect. There's no need for handle 563 // downloaded from the server to be perfect. There's no need for handle
559 // errors smartly. 564 // errors smartly.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 if (it != params.end()) 767 if (it != params.end())
763 return it->second; 768 return it->second;
764 // Fall back to the global instant extended context. 769 // Fall back to the global instant extended context.
765 it = params.find(rule + ":" + page_classification_str + ":*"); 770 it = params.find(rule + ":" + page_classification_str + ":*");
766 if (it != params.end()) 771 if (it != params.end())
767 return it->second; 772 return it->second;
768 // Look up rule in the global context. 773 // Look up rule in the global context.
769 it = params.find(rule + ":*:*"); 774 it = params.find(rule + ":*:*");
770 return (it != params.end()) ? it->second : std::string(); 775 return (it != params.end()) ? it->second : std::string();
771 } 776 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_field_trial.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698