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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 287 |
288 if (switch_value == switches::kSpeculativeResourcePrefetchingLearning) | 288 if (switch_value == switches::kSpeculativeResourcePrefetchingLearning) |
289 return true; | 289 return true; |
290 } | 290 } |
291 | 291 |
292 const int group = FieldTrialList::FindValue( | 292 const int group = FieldTrialList::FindValue( |
293 kSpeculativePrefetchingLearningTrialName); | 293 kSpeculativePrefetchingLearningTrialName); |
294 return group == g_speculative_prefetching_learning_default_group_number; | 294 return group == g_speculative_prefetching_learning_default_group_number; |
295 } | 295 } |
296 | 296 |
297 bool IsSpeculativeResourcePrefetchingEnabled(Profile* profile) { | |
298 if (!profile) | |
299 return false; | |
300 | |
301 // Check if the user has set a command line flag. | |
302 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
303 switches::kSpeculativeResourcePrefetching)) { | |
304 const std::string switch_value = | |
305 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
306 switches::kSpeculativeResourcePrefetching); | |
307 | |
308 if (switch_value == switches::kSpeculativeResourcePrefetchingEnabled) | |
dominich
2012/08/02 15:00:50
this could be
return switch_value == switches::k
Shishir
2012/08/02 22:06:54
Done.
| |
309 return true; | |
310 } | |
311 | |
312 return false; | |
313 } | |
314 | |
297 } // namespace prerender | 315 } // namespace prerender |
OLD | NEW |