Refactoring : Move AuthAttempt and Authenticators to chromeos/login
[chromium-blink-merge.git] / chrome / browser / omaha_query_params / chrome_omaha_query_params_delegate.cc
blob40d1eeda3beb69e99f297189cbf47e531b75c5a9
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
3 // found in the LICENSE file.
5 #include "chrome/browser/omaha_query_params/chrome_omaha_query_params_delegate.h"
7 #include "base/lazy_instance.h"
8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/browser_process.h"
10 #include "chrome/common/chrome_version_info.h"
12 namespace {
14 const char kUnknown[] = "unknown";
15 const char kStable[] = "stable";
16 const char kBeta[] = "beta";
17 const char kDev[] = "dev";
18 const char kCanary[] = "canary";
20 base::LazyInstance<ChromeOmahaQueryParamsDelegate> g_delegate =
21 LAZY_INSTANCE_INITIALIZER;
23 } // namespace
25 ChromeOmahaQueryParamsDelegate::ChromeOmahaQueryParamsDelegate() {
28 ChromeOmahaQueryParamsDelegate::~ChromeOmahaQueryParamsDelegate() {
31 // static
32 ChromeOmahaQueryParamsDelegate* ChromeOmahaQueryParamsDelegate::GetInstance() {
33 return g_delegate.Pointer();
36 std::string ChromeOmahaQueryParamsDelegate::GetExtraParams() {
37 return base::StringPrintf("&prodchannel=%s&prodversion=%s&lang=%s",
38 GetChannelString(),
39 chrome::VersionInfo().Version().c_str(),
40 GetLang());
43 // static
44 const char* ChromeOmahaQueryParamsDelegate::GetChannelString() {
45 switch (chrome::VersionInfo::GetChannel()) {
46 case chrome::VersionInfo::CHANNEL_STABLE:
47 return kStable;
48 break;
49 case chrome::VersionInfo::CHANNEL_BETA:
50 return kBeta;
51 break;
52 case chrome::VersionInfo::CHANNEL_DEV:
53 return kDev;
54 break;
55 case chrome::VersionInfo::CHANNEL_CANARY:
56 return kCanary;
57 break;
58 case chrome::VersionInfo::CHANNEL_UNKNOWN:
59 return kUnknown;
60 break;
62 return kUnknown;
65 // static
66 const char* ChromeOmahaQueryParamsDelegate::GetLang() {
67 return g_browser_process->GetApplicationLocale().c_str();