Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / update_client / chrome_update_query_params_delegate.cc
blob0e6b2abe0c54ebc7440df6c7d21e19f66118c7df
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/channel_info.h"
11 #include "components/version_info/version_info.h"
13 namespace {
15 const char kUnknown[] = "unknown";
16 const char kStable[] = "stable";
17 const char kBeta[] = "beta";
18 const char kDev[] = "dev";
19 const char kCanary[] = "canary";
21 base::LazyInstance<ChromeUpdateQueryParamsDelegate> g_delegate =
22 LAZY_INSTANCE_INITIALIZER;
24 } // namespace
26 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() {
29 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() {
32 // static
33 ChromeUpdateQueryParamsDelegate*
34 ChromeUpdateQueryParamsDelegate::GetInstance() {
35 return g_delegate.Pointer();
38 std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() {
39 return base::StringPrintf(
40 "&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString(),
41 version_info::GetVersionNumber().c_str(), GetLang());
44 // static
45 const char* ChromeUpdateQueryParamsDelegate::GetChannelString() {
46 switch (chrome::GetChannel()) {
47 case version_info::Channel::STABLE:
48 return kStable;
49 break;
50 case version_info::Channel::BETA:
51 return kBeta;
52 break;
53 case version_info::Channel::DEV:
54 return kDev;
55 break;
56 case version_info::Channel::CANARY:
57 return kCanary;
58 break;
59 case version_info::Channel::UNKNOWN:
60 return kUnknown;
61 break;
63 return kUnknown;
66 // static
67 const char* ChromeUpdateQueryParamsDelegate::GetLang() {
68 return g_browser_process->GetApplicationLocale().c_str();