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

Side by Side Diff: chrome/browser/predictors/resource_prefetch_common.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/predictors/resource_prefetch_common.h" 5 #include "chrome/browser/predictors/resource_prefetch_common.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 Profile* profile, 53 Profile* profile,
54 ResourcePrefetchPredictorConfig* config) { 54 ResourcePrefetchPredictorConfig* config) {
55 DCHECK(config); 55 DCHECK(config);
56 56
57 // Off the record - disabled. 57 // Off the record - disabled.
58 if (!profile || profile->IsOffTheRecord()) 58 if (!profile || profile->IsOffTheRecord())
59 return false; 59 return false;
60 60
61 // Enabled by command line switch. The config has the default params already 61 // Enabled by command line switch. The config has the default params already
62 // set. The command line with just enable them with the default params. 62 // set. The command line with just enable them with the default params.
63 if (CommandLine::ForCurrentProcess()->HasSwitch( 63 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
64 switches::kSpeculativeResourcePrefetching)) { 64 switches::kSpeculativeResourcePrefetching)) {
65 const std::string value = 65 const std::string value =
66 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 66 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
67 switches::kSpeculativeResourcePrefetching); 67 switches::kSpeculativeResourcePrefetching);
68 68
69 if (value == switches::kSpeculativeResourcePrefetchingDisabled) { 69 if (value == switches::kSpeculativeResourcePrefetchingDisabled) {
70 return false; 70 return false;
71 } else if (value == switches::kSpeculativeResourcePrefetchingLearning) { 71 } else if (value == switches::kSpeculativeResourcePrefetchingLearning) {
72 config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; 72 config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING;
73 config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; 73 config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING;
74 return true; 74 return true;
75 } else if (value == switches::kSpeculativeResourcePrefetchingEnabled) { 75 } else if (value == switches::kSpeculativeResourcePrefetchingEnabled) {
76 config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; 76 config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 bool ResourcePrefetchPredictorConfig::IsMoreResourcesEnabledForTest() const { 263 bool ResourcePrefetchPredictorConfig::IsMoreResourcesEnabledForTest() const {
264 return max_resources_per_entry == 100; 264 return max_resources_per_entry == 100;
265 } 265 }
266 266
267 bool ResourcePrefetchPredictorConfig::IsSmallDBEnabledForTest() const { 267 bool ResourcePrefetchPredictorConfig::IsSmallDBEnabledForTest() const {
268 return max_urls_to_track == 200 && max_hosts_to_track == 100; 268 return max_urls_to_track == 200 && max_hosts_to_track == 100;
269 } 269 }
270 270
271 } // namespace predictors 271 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/predictors/autocomplete_action_predictor_unittest.cc ('k') | chrome/browser/prefetch/prefetch_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698