Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / update_client / chrome_update_query_params_delegate.cc
blobfdb8038c25e746ab7368262ffbe6e72a952ffe88
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"
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<ChromeUpdateQueryParamsDelegate> g_delegate =
21 LAZY_INSTANCE_INITIALIZER;
23 } // namespace
25 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() {
28 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() {
31 // static
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",
39 GetChannelString(),
40 chrome::VersionInfo().Version().c_str(), GetLang());
43 // static
44 const char* ChromeUpdateQueryParamsDelegate::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* ChromeUpdateQueryParamsDelegate::GetLang() {
67 return g_browser_process->GetApplicationLocale().c_str();