| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/update_client/ios_chrome_update_query_params_delega
te.h" | 5 #include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delega
te.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 "components/version_info/version_info.h" | 9 #include "components/version_info/version_info.h" |
| 10 #include "ios/chrome/browser/application_context.h" | 10 #include "ios/chrome/browser/application_context.h" |
| 11 #include "ios/chrome/common/channel_info.h" | 11 #include "ios/chrome/common/channel_info.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 base::LazyInstance<IOSChromeUpdateQueryParamsDelegate> g_delegate = | 15 base::LazyInstance<IOSChromeUpdateQueryParamsDelegate>::DestructorAtExit |
| 16 LAZY_INSTANCE_INITIALIZER; | 16 g_delegate = LAZY_INSTANCE_INITIALIZER; |
| 17 | 17 |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 IOSChromeUpdateQueryParamsDelegate::IOSChromeUpdateQueryParamsDelegate() {} | 20 IOSChromeUpdateQueryParamsDelegate::IOSChromeUpdateQueryParamsDelegate() {} |
| 21 | 21 |
| 22 IOSChromeUpdateQueryParamsDelegate::~IOSChromeUpdateQueryParamsDelegate() {} | 22 IOSChromeUpdateQueryParamsDelegate::~IOSChromeUpdateQueryParamsDelegate() {} |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 IOSChromeUpdateQueryParamsDelegate* | 25 IOSChromeUpdateQueryParamsDelegate* |
| 26 IOSChromeUpdateQueryParamsDelegate::GetInstance() { | 26 IOSChromeUpdateQueryParamsDelegate::GetInstance() { |
| 27 return g_delegate.Pointer(); | 27 return g_delegate.Pointer(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 std::string IOSChromeUpdateQueryParamsDelegate::GetExtraParams() { | 30 std::string IOSChromeUpdateQueryParamsDelegate::GetExtraParams() { |
| 31 return base::StringPrintf( | 31 return base::StringPrintf( |
| 32 "&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString().c_str(), | 32 "&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString().c_str(), |
| 33 version_info::GetVersionNumber().c_str(), GetLang().c_str()); | 33 version_info::GetVersionNumber().c_str(), GetLang().c_str()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 // static | 36 // static |
| 37 const std::string& IOSChromeUpdateQueryParamsDelegate::GetLang() { | 37 const std::string& IOSChromeUpdateQueryParamsDelegate::GetLang() { |
| 38 return GetApplicationContext()->GetApplicationLocale(); | 38 return GetApplicationContext()->GetApplicationLocale(); |
| 39 } | 39 } |
| OLD | NEW |