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

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

Issue 23621037: Send URLs on non-zero prefix suggest requests also. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move set_current_page_url Created 7 years, 3 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
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"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "chrome/browser/autocomplete/autocomplete_input.h" 14 #include "chrome/browser/autocomplete/autocomplete_input.h"
15 #include "chrome/browser/search/search.h" 15 #include "chrome/browser/search/search.h"
16 #include "chrome/common/metrics/variations/variation_ids.h" 16 #include "chrome/common/metrics/variations/variation_ids.h"
17 #include "chrome/common/metrics/variations/variations_util.h" 17 #include "chrome/common/metrics/variations/variations_util.h"
18 #include "components/variations/metrics_util.h" 18 #include "components/variations/metrics_util.h"
19 19
20 namespace { 20 namespace {
21 21
22 // Field trial names. 22 // Field trial names.
23 const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects"; 23 const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects";
24 const char kHUPCreateShorterMatchFieldTrialName[] = 24 const char kHUPCreateShorterMatchFieldTrialName[] =
25 "OmniboxHUPCreateShorterMatch"; 25 "OmniboxHUPCreateShorterMatch";
26 const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; 26 const char kStopTimerFieldTrialName[] = "OmniboxStopTimer";
27 const char kEnableZeroSuggestGroupPrefix[] = "EnableZeroSuggest"; 27 const char kEnableZeroSuggestGroupPrefix[] = "EnableZeroSuggest";
28 const char kEnableZeroSuggestMostVisitedGroupPrefix[] = 28 const char kEnableZeroSuggestMostVisitedGroupPrefix[] =
29 "EnableZeroSuggestMostVisited"; 29 "EnableZeroSuggestMostVisited";
30 const char kEnableZeroSuggestAfterTypingGroupPrefix[] =
31 "EnableZeroSuggestAfterTyping";
30 32
31 // The autocomplete dynamic field trial name prefix. Each field trial is 33 // The autocomplete dynamic field trial name prefix. Each field trial is
32 // configured dynamically and is retrieved automatically by Chrome during 34 // configured dynamically and is retrieved automatically by Chrome during
33 // the startup. 35 // the startup.
34 const char kAutocompleteDynamicFieldTrialPrefix[] = "AutocompleteDynamicTrial_"; 36 const char kAutocompleteDynamicFieldTrialPrefix[] = "AutocompleteDynamicTrial_";
35 // The maximum number of the autocomplete dynamic field trials (aka layers). 37 // The maximum number of the autocomplete dynamic field trials (aka layers).
36 const int kMaxAutocompleteDynamicFieldTrials = 5; 38 const int kMaxAutocompleteDynamicFieldTrials = 5;
37 39
38 // Field trial experiment probabilities. 40 // Field trial experiment probabilities.
39 41
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 204
203 bool OmniboxFieldTrial::InZeroSuggestFieldTrial() { 205 bool OmniboxFieldTrial::InZeroSuggestFieldTrial() {
204 return HasDynamicFieldTrialGroupPrefix(kEnableZeroSuggestGroupPrefix); 206 return HasDynamicFieldTrialGroupPrefix(kEnableZeroSuggestGroupPrefix);
205 } 207 }
206 208
207 bool OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial() { 209 bool OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial() {
208 return HasDynamicFieldTrialGroupPrefix( 210 return HasDynamicFieldTrialGroupPrefix(
209 kEnableZeroSuggestMostVisitedGroupPrefix); 211 kEnableZeroSuggestMostVisitedGroupPrefix);
210 } 212 }
211 213
214 bool OmniboxFieldTrial::InZeroSuggestAfterTypingFieldTrial() {
215 return HasDynamicFieldTrialGroupPrefix(
216 kEnableZeroSuggestAfterTypingGroupPrefix);
217 }
218
212 bool OmniboxFieldTrial::ShortcutsScoringMaxRelevance( 219 bool OmniboxFieldTrial::ShortcutsScoringMaxRelevance(
213 AutocompleteInput::PageClassification current_page_classification, 220 AutocompleteInput::PageClassification current_page_classification,
214 int* max_relevance) { 221 int* max_relevance) {
215 // The value of the rule is a string that encodes an integer containing 222 // The value of the rule is a string that encodes an integer containing
216 // the max relevance. 223 // the max relevance.
217 const std::string& max_relevance_str = 224 const std::string& max_relevance_str =
218 OmniboxFieldTrial::GetValueForRuleInContext( 225 OmniboxFieldTrial::GetValueForRuleInContext(
219 kShortcutsScoringMaxRelevanceRule, current_page_classification); 226 kShortcutsScoringMaxRelevanceRule, current_page_classification);
220 if (max_relevance_str.empty()) 227 if (max_relevance_str.empty())
221 return false; 228 return false;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (it != params.end()) 345 if (it != params.end())
339 return it->second; 346 return it->second;
340 // Fall back to the global instant extended context. 347 // Fall back to the global instant extended context.
341 it = params.find(rule + ":" + page_classification_str + ":*"); 348 it = params.find(rule + ":" + page_classification_str + ":*");
342 if (it != params.end()) 349 if (it != params.end())
343 return it->second; 350 return it->second;
344 // Look up rule in the global context. 351 // Look up rule in the global context.
345 it = params.find(rule + ":*:*"); 352 it = params.find(rule + ":*:*");
346 return (it != params.end()) ? it->second : std::string(); 353 return (it != params.end()) ? it->second : std::string();
347 } 354 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698