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

Side by Side Diff: chrome/browser/metrics/variations/variations_service.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 (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/metrics/variations/variations_service.h" 5 #include "chrome/browser/metrics/variations/variations_service.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 case chrome::VersionInfo::CHANNEL_DEV: 73 case chrome::VersionInfo::CHANNEL_DEV:
74 return variations::Study_Channel_DEV; 74 return variations::Study_Channel_DEV;
75 case chrome::VersionInfo::CHANNEL_BETA: 75 case chrome::VersionInfo::CHANNEL_BETA:
76 return variations::Study_Channel_BETA; 76 return variations::Study_Channel_BETA;
77 case chrome::VersionInfo::CHANNEL_STABLE: 77 case chrome::VersionInfo::CHANNEL_STABLE:
78 return variations::Study_Channel_STABLE; 78 return variations::Study_Channel_STABLE;
79 case chrome::VersionInfo::CHANNEL_UNKNOWN: 79 case chrome::VersionInfo::CHANNEL_UNKNOWN:
80 break; 80 break;
81 } 81 }
82 const std::string forced_channel = 82 const std::string forced_channel =
83 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 83 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
84 switches::kFakeVariationsChannel); 84 switches::kFakeVariationsChannel);
85 if (forced_channel == "stable") 85 if (forced_channel == "stable")
86 return variations::Study_Channel_STABLE; 86 return variations::Study_Channel_STABLE;
87 if (forced_channel == "beta") 87 if (forced_channel == "beta")
88 return variations::Study_Channel_BETA; 88 return variations::Study_Channel_BETA;
89 if (forced_channel == "dev") 89 if (forced_channel == "dev")
90 return variations::Study_Channel_DEV; 90 return variations::Study_Channel_DEV;
91 if (forced_channel == "canary") 91 if (forced_channel == "canary")
92 return variations::Study_Channel_CANARY; 92 return variations::Study_Channel_CANARY;
93 DVLOG(1) << "Invalid channel provided: " << forced_channel; 93 DVLOG(1) << "Invalid channel provided: " << forced_channel;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 #endif 367 #endif
368 368
369 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) { 369 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) {
370 create_trials_from_seed_called_ = called; 370 create_trials_from_seed_called_ = called;
371 } 371 }
372 372
373 // static 373 // static
374 GURL VariationsService::GetVariationsServerURL( 374 GURL VariationsService::GetVariationsServerURL(
375 PrefService* policy_pref_service) { 375 PrefService* policy_pref_service) {
376 std::string server_url_string(CommandLine::ForCurrentProcess()-> 376 std::string server_url_string(
377 GetSwitchValueASCII(switches::kVariationsServerURL)); 377 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
378 switches::kVariationsServerURL));
378 if (server_url_string.empty()) 379 if (server_url_string.empty())
379 server_url_string = kDefaultVariationsServerURL; 380 server_url_string = kDefaultVariationsServerURL;
380 GURL server_url = GURL(server_url_string); 381 GURL server_url = GURL(server_url_string);
381 382
382 const std::string restrict_param = 383 const std::string restrict_param =
383 GetRestrictParameterPref(policy_pref_service); 384 GetRestrictParameterPref(policy_pref_service);
384 if (!restrict_param.empty()) { 385 if (!restrict_param.empty()) {
385 server_url = net::AppendOrReplaceQueryParameter(server_url, 386 server_url = net::AppendOrReplaceQueryParameter(server_url,
386 "restrict", 387 "restrict",
387 restrict_param); 388 restrict_param);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 422 }
422 423
423 // static 424 // static
424 scoped_ptr<VariationsService> VariationsService::Create( 425 scoped_ptr<VariationsService> VariationsService::Create(
425 PrefService* local_state, 426 PrefService* local_state,
426 metrics::MetricsStateManager* state_manager) { 427 metrics::MetricsStateManager* state_manager) {
427 scoped_ptr<VariationsService> result; 428 scoped_ptr<VariationsService> result;
428 #if !defined(GOOGLE_CHROME_BUILD) 429 #if !defined(GOOGLE_CHROME_BUILD)
429 // Unless the URL was provided, unsupported builds should return NULL to 430 // Unless the URL was provided, unsupported builds should return NULL to
430 // indicate that the service should not be used. 431 // indicate that the service should not be used.
431 if (!CommandLine::ForCurrentProcess()->HasSwitch( 432 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
432 switches::kVariationsServerURL)) { 433 switches::kVariationsServerURL)) {
433 DVLOG(1) << "Not creating VariationsService in unofficial build without --" 434 DVLOG(1) << "Not creating VariationsService in unofficial build without --"
434 << switches::kVariationsServerURL << " specified."; 435 << switches::kVariationsServerURL << " specified.";
435 return result.Pass(); 436 return result.Pass();
436 } 437 }
437 #endif 438 #endif
438 result.reset(new VariationsService( 439 result.reset(new VariationsService(
439 new web_resource::ResourceRequestAllowedNotifier( 440 new web_resource::ResourceRequestAllowedNotifier(
440 local_state, switches::kDisableBackgroundNetworking), 441 local_state, switches::kDisableBackgroundNetworking),
441 local_state, state_manager)); 442 local_state, state_manager));
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 local_state_->SetInt64(prefs::kVariationsLastFetchTime, 638 local_state_->SetInt64(prefs::kVariationsLastFetchTime,
638 base::Time::Now().ToInternalValue()); 639 base::Time::Now().ToInternalValue());
639 } 640 }
640 } 641 }
641 642
642 std::string VariationsService::GetInvalidVariationsSeedSignature() const { 643 std::string VariationsService::GetInvalidVariationsSeedSignature() const {
643 return seed_store_.GetInvalidSignature(); 644 return seed_store_.GetInvalidSignature();
644 } 645 }
645 646
646 } // namespace chrome_variations 647 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « chrome/browser/metrics/thread_watcher_unittest.cc ('k') | chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698