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/update_client/chrome_update_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
<ChromeUpdateQueryParamsDelegate
> g_delegate
=
21 LAZY_INSTANCE_INITIALIZER
;
25 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() {
28 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() {
32 ChromeUpdateQueryParamsDelegate
*
33 ChromeUpdateQueryParamsDelegate::GetInstance() {
34 return g_delegate
.Pointer();
37 std::string
ChromeUpdateQueryParamsDelegate::GetExtraParams() {
38 return base::StringPrintf("&prodchannel=%s&prodversion=%s&lang=%s",
40 chrome::VersionInfo().Version().c_str(), GetLang());
44 const char* ChromeUpdateQueryParamsDelegate::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* ChromeUpdateQueryParamsDelegate::GetLang() {
67 return g_browser_process
->GetApplicationLocale().c_str();