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

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: Review comments 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/update_client/update_query_params.h"
11 #include "components/version_info/version_info.h" 12 #include "components/version_info/version_info.h"
12 13
13 namespace { 14 namespace {
14 15
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 = 16 base::LazyInstance<ChromeUpdateQueryParamsDelegate> g_delegate =
22 LAZY_INSTANCE_INITIALIZER; 17 LAZY_INSTANCE_INITIALIZER;
23 18
24 } // namespace 19 } // namespace
25 20
26 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() { 21 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() {
27 } 22 }
28 23
29 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() { 24 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() {
30 } 25 }
31 26
32 // static 27 // static
33 ChromeUpdateQueryParamsDelegate* 28 ChromeUpdateQueryParamsDelegate*
34 ChromeUpdateQueryParamsDelegate::GetInstance() { 29 ChromeUpdateQueryParamsDelegate::GetInstance() {
35 return g_delegate.Pointer(); 30 return g_delegate.Pointer();
36 } 31 }
37 32
38 std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() { 33 std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() {
39 return base::StringPrintf( 34 return base::StringPrintf(
40 "&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString(), 35 "&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString(),
41 version_info::GetVersionNumber().c_str(), GetLang()); 36 version_info::GetVersionNumber().c_str(), GetLang());
42 } 37 }
43 38
44 // static 39 // static
45 const char* ChromeUpdateQueryParamsDelegate::GetChannelString() { 40 const char* ChromeUpdateQueryParamsDelegate::GetChannelString() {
46 switch (chrome::GetChannel()) { 41 return update_client::UpdateQueryParams::GetChannelString(
47 case version_info::Channel::STABLE: 42 chrome::GetChannel());
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 } 43 }
65 44
66 // static 45 // static
67 const char* ChromeUpdateQueryParamsDelegate::GetLang() { 46 const char* ChromeUpdateQueryParamsDelegate::GetLang() {
68 return g_browser_process->GetApplicationLocale().c_str(); 47 return g_browser_process->GetApplicationLocale().c_str();
69 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698