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"
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
;
25 ChromeOmahaQueryParamsDelegate::ChromeOmahaQueryParamsDelegate() {
28 ChromeOmahaQueryParamsDelegate::~ChromeOmahaQueryParamsDelegate() {
32 ChromeOmahaQueryParamsDelegate
* ChromeOmahaQueryParamsDelegate::GetInstance() {
33 return g_delegate
.Pointer();
36 std::string
ChromeOmahaQueryParamsDelegate::GetExtraParams() {
37 return base::StringPrintf("&prodchannel=%s&prodversion=%s&lang=%s",
39 chrome::VersionInfo().Version().c_str(),
44 const char* ChromeOmahaQueryParamsDelegate::GetChannelString() {
45 switch (chrome::VersionInfo::GetChannel()) {
46 case chrome::VersionInfo::CHANNEL_STABLE
:
49 case chrome::VersionInfo::CHANNEL_BETA
:
52 case chrome::VersionInfo::CHANNEL_DEV
:
55 case chrome::VersionInfo::CHANNEL_CANARY
:
58 case chrome::VersionInfo::CHANNEL_UNKNOWN
:
66 const char* ChromeOmahaQueryParamsDelegate::GetLang() {
67 return g_browser_process
->GetApplicationLocale().c_str();