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" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 | 271 |
272 if (switch_value == switches::kSpeculativeResourcePrefetchingLearning) | 272 if (switch_value == switches::kSpeculativeResourcePrefetchingLearning) |
273 return true; | 273 return true; |
274 } | 274 } |
275 | 275 |
276 const int group = base::FieldTrialList::FindValue( | 276 const int group = base::FieldTrialList::FindValue( |
277 kSpeculativePrefetchingLearningTrialName); | 277 kSpeculativePrefetchingLearningTrialName); |
278 return group == g_speculative_prefetching_learning_default_group_number; | 278 return group == g_speculative_prefetching_learning_default_group_number; |
279 } | 279 } |
280 | 280 |
281 bool IsSpeculativeResourcePrefetchingEnabled(Profile* profile) { | |
282 if (!profile) | |
283 return false; | |
284 | |
285 // Override any field trial groups if the user has set a command line flag. | |
dominich
2012/07/23 16:04:41
what field trial? You don't check a field trial.
Shishir
2012/08/01 22:35:24
Done.
| |
286 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
287 switches::kSpeculativeResourcePrefetching)) { | |
288 const std::string switch_value = | |
289 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
290 switches::kSpeculativeResourcePrefetching); | |
291 | |
292 if (switch_value == switches::kSpeculativeResourcePrefetchingEnabled) | |
293 return true; | |
294 } | |
295 | |
296 return false; | |
297 } | |
298 | |
281 } // namespace prerender | 299 } // namespace prerender |
OLD | NEW |