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

Side by Side Diff: chrome/browser/prerender/prerender_field_trial.cc

Issue 9610006: Refactoring, moving and renaming the NetworkActionPredictor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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/prerender/prerender_field_trial.h" 5 #include "chrome/browser/prerender/prerender_field_trial.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "chrome/browser/autocomplete/network_action_predictor.h"
12 #include "chrome/browser/metrics/metrics_service.h" 11 #include "chrome/browser/metrics/metrics_service.h"
12 #include "chrome/browser/predictors/autocomplete_action_predictor.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/prerender/prerender_manager.h" 14 #include "chrome/browser/prerender/prerender_manager.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/chrome_version_info.h" 17 #include "chrome/common/chrome_version_info.h"
18 #include "content/browser/renderer_host/resource_dispatcher_host.h" 18 #include "content/browser/renderer_host/resource_dispatcher_host.h"
19 19
20 namespace prerender { 20 namespace prerender {
21 21
22 namespace { 22 namespace {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 new base::FieldTrial("OmniboxPrerenderHitWeightingTrial", kDivisor, 189 new base::FieldTrial("OmniboxPrerenderHitWeightingTrial", kDivisor,
190 "OmniboxPrerenderWeight1.0", 2012, 8, 30)); 190 "OmniboxPrerenderWeight1.0", 2012, 8, 30));
191 const int kOmniboxWeightFourGroup = 191 const int kOmniboxWeightFourGroup =
192 weighting_trial->AppendGroup("OmniboxPrerenderWeight4.0", 192 weighting_trial->AppendGroup("OmniboxPrerenderWeight4.0",
193 kFourProbability); 193 kFourProbability);
194 const int kOmniboxWeightEightGroup = 194 const int kOmniboxWeightEightGroup =
195 weighting_trial->AppendGroup("OmniboxPrerenderWeight8.0", 195 weighting_trial->AppendGroup("OmniboxPrerenderWeight8.0",
196 kEightProbability); 196 kEightProbability);
197 const int group = weighting_trial->group(); 197 const int group = weighting_trial->group();
198 if (group == kOmniboxWeightFourGroup) 198 if (group == kOmniboxWeightFourGroup)
199 NetworkActionPredictor::set_hit_weight(4.0); 199 predictors::AutocompleteActionPredictor::set_hit_weight(4.0);
200 else if (group == kOmniboxWeightEightGroup) 200 else if (group == kOmniboxWeightEightGroup)
201 NetworkActionPredictor::set_hit_weight(8.0); 201 predictors::AutocompleteActionPredictor::set_hit_weight(8.0);
202 } 202 }
203 203
204 bool IsOmniboxEnabled(Profile* profile) { 204 bool IsOmniboxEnabled(Profile* profile) {
205 if (!profile || profile->IsOffTheRecord()) 205 if (!profile || profile->IsOffTheRecord())
206 return false; 206 return false;
207 207
208 if (!PrerenderManager::IsPrerenderingPossible()) 208 if (!PrerenderManager::IsPrerenderingPossible())
209 return false; 209 return false;
210 210
211 // Override any field trial groups if the user has set a command line flag. 211 // Override any field trial groups if the user has set a command line flag.
(...skipping 11 matching lines...) Expand all
223 223
224 DCHECK(switch_value == switches::kPrerenderFromOmniboxSwitchValueAuto); 224 DCHECK(switch_value == switches::kPrerenderFromOmniboxSwitchValueAuto);
225 } 225 }
226 226
227 const int group = base::FieldTrialList::FindValue(kOmniboxTrialName); 227 const int group = base::FieldTrialList::FindValue(kOmniboxTrialName);
228 return group == base::FieldTrial::kNotFinalized || 228 return group == base::FieldTrial::kNotFinalized ||
229 group == base::FieldTrial::kDefaultGroupNumber; 229 group == base::FieldTrial::kDefaultGroupNumber;
230 } 230 }
231 231
232 } // namespace prerender 232 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698