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