Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Side by Side Diff: chrome/browser/update_client/chrome_update_query_params_delegate.cc

Issue 1281913002: Componentize ComponentUpdaterConfigurator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS compile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" 5 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/common/channel_info.h" 10 #include "chrome/common/channel_info.h"
11 #include "components/version_info/version_info.h" 11 #include "components/version_info/version_info.h"
12 12
13 namespace { 13 namespace {
14 14
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";
20
21 base::LazyInstance<ChromeUpdateQueryParamsDelegate> g_delegate = 15 base::LazyInstance<ChromeUpdateQueryParamsDelegate> g_delegate =
22 LAZY_INSTANCE_INITIALIZER; 16 LAZY_INSTANCE_INITIALIZER;
23 17
24 } // namespace 18 } // namespace
25 19
26 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() { 20 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() {
27 } 21 }
28 22
29 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() { 23 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() {
30 } 24 }
31 25
32 // static 26 // static
33 ChromeUpdateQueryParamsDelegate* 27 ChromeUpdateQueryParamsDelegate*
34 ChromeUpdateQueryParamsDelegate::GetInstance() { 28 ChromeUpdateQueryParamsDelegate::GetInstance() {
35 return g_delegate.Pointer(); 29 return g_delegate.Pointer();
36 } 30 }
37 31
38 std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() { 32 std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() {
39 return base::StringPrintf( 33 return base::StringPrintf("&prodchannel=%s&prodversion=%s&lang=%s",
40 "&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString(), 34 chrome::GetChannelString().c_str(),
41 version_info::GetVersionNumber().c_str(), GetLang()); 35 version_info::GetVersionNumber().c_str(),
36 GetLang());
42 } 37 }
43 38
44 // static 39 // 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;
62 }
63 return kUnknown;
64 }
65
66 // static
67 const char* ChromeUpdateQueryParamsDelegate::GetLang() { 40 const char* ChromeUpdateQueryParamsDelegate::GetLang() {
68 return g_browser_process->GetApplicationLocale().c_str(); 41 return g_browser_process->GetApplicationLocale().c_str();
69 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698