| OLD | NEW |
| 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 base::LazyInstance<ChromeUpdateQueryParamsDelegate> g_delegate = | 15 base::LazyInstance<ChromeUpdateQueryParamsDelegate>::DestructorAtExit |
| 16 LAZY_INSTANCE_INITIALIZER; | 16 g_delegate = LAZY_INSTANCE_INITIALIZER; |
| 17 | 17 |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() { | 20 ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() { | 23 ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 ChromeUpdateQueryParamsDelegate* | 27 ChromeUpdateQueryParamsDelegate* |
| 28 ChromeUpdateQueryParamsDelegate::GetInstance() { | 28 ChromeUpdateQueryParamsDelegate::GetInstance() { |
| 29 return g_delegate.Pointer(); | 29 return g_delegate.Pointer(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() { | 32 std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() { |
| 33 return base::StringPrintf("&prodchannel=%s&prodversion=%s&lang=%s", | 33 return base::StringPrintf("&prodchannel=%s&prodversion=%s&lang=%s", |
| 34 chrome::GetChannelString().c_str(), | 34 chrome::GetChannelString().c_str(), |
| 35 version_info::GetVersionNumber().c_str(), | 35 version_info::GetVersionNumber().c_str(), |
| 36 GetLang()); | 36 GetLang()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // static | 39 // static |
| 40 const char* ChromeUpdateQueryParamsDelegate::GetLang() { | 40 const char* ChromeUpdateQueryParamsDelegate::GetLang() { |
| 41 return g_browser_process->GetApplicationLocale().c_str(); | 41 return g_browser_process->GetApplicationLocale().c_str(); |
| 42 } | 42 } |
| OLD | NEW |