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

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: Addressing Dominic's comments. 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 new base::FieldTrial("OmniboxPrerenderHitWeightingTrial", kDivisor, 207 new base::FieldTrial("OmniboxPrerenderHitWeightingTrial", kDivisor,
208 "OmniboxPrerenderWeight1.0", 2012, 8, 30)); 208 "OmniboxPrerenderWeight1.0", 2012, 8, 30));
209 const int kOmniboxWeightFourGroup = 209 const int kOmniboxWeightFourGroup =
210 weighting_trial->AppendGroup("OmniboxPrerenderWeight4.0", 210 weighting_trial->AppendGroup("OmniboxPrerenderWeight4.0",
211 kFourProbability); 211 kFourProbability);
212 const int kOmniboxWeightEightGroup = 212 const int kOmniboxWeightEightGroup =
213 weighting_trial->AppendGroup("OmniboxPrerenderWeight8.0", 213 weighting_trial->AppendGroup("OmniboxPrerenderWeight8.0",
214 kEightProbability); 214 kEightProbability);
215 const int group = weighting_trial->group(); 215 const int group = weighting_trial->group();
216 if (group == kOmniboxWeightFourGroup) 216 if (group == kOmniboxWeightFourGroup)
217 NetworkActionPredictor::set_hit_weight(4.0); 217 predictors::AutocompleteActionPredictor::set_hit_weight(4.0);
218 else if (group == kOmniboxWeightEightGroup) 218 else if (group == kOmniboxWeightEightGroup)
219 NetworkActionPredictor::set_hit_weight(8.0); 219 predictors::AutocompleteActionPredictor::set_hit_weight(8.0);
220 } 220 }
221 221
222 bool IsOmniboxEnabled(Profile* profile) { 222 bool IsOmniboxEnabled(Profile* profile) {
223 if (!profile || profile->IsOffTheRecord()) 223 if (!profile || profile->IsOffTheRecord())
224 return false; 224 return false;
225 225
226 if (!PrerenderManager::IsPrerenderingPossible()) 226 if (!PrerenderManager::IsPrerenderingPossible())
227 return false; 227 return false;
228 228
229 // Override any field trial groups if the user has set a command line flag. 229 // Override any field trial groups if the user has set a command line flag.
(...skipping 11 matching lines...) Expand all
241 241
242 DCHECK(switch_value == switches::kPrerenderFromOmniboxSwitchValueAuto); 242 DCHECK(switch_value == switches::kPrerenderFromOmniboxSwitchValueAuto);
243 } 243 }
244 244
245 const int group = base::FieldTrialList::FindValue(kOmniboxTrialName); 245 const int group = base::FieldTrialList::FindValue(kOmniboxTrialName);
246 return group == base::FieldTrial::kNotFinalized || 246 return group == base::FieldTrial::kNotFinalized ||
247 group == base::FieldTrial::kDefaultGroupNumber; 247 group == base::FieldTrial::kDefaultGroupNumber;
248 } 248 }
249 249
250 } // namespace prerender 250 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698