| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/install_static/install_details.h" | 5 #include "chrome/install_static/install_details.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <type_traits> | 10 #include <type_traits> |
| 11 | 11 |
| 12 #include "chrome/install_static/install_modes.h" | 12 #include "chrome/install_static/install_modes.h" |
| 13 #include "chrome/install_static/install_util.h" | 13 #include "chrome/install_static/install_util.h" |
| 14 #include "chrome_elf/nt_registry/nt_registry.h" | 14 #include "chrome_elf/nt_registry/nt_registry.h" |
| 15 #include "components/version_info/channel.h" |
| 15 #include "components/version_info/version_info_values.h" | 16 #include "components/version_info/version_info_values.h" |
| 16 | 17 |
| 17 namespace install_static { | 18 namespace install_static { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // The version is set at compile-time to a W.X.Y.Z value. | 22 // The version is set at compile-time to a W.X.Y.Z value. |
| 22 constexpr char kProductVersion[] = PRODUCT_VERSION; | 23 constexpr char kProductVersion[] = PRODUCT_VERSION; |
| 23 | 24 |
| 24 // This module's instance (intentionally leaked at shutdown). | 25 // This module's instance (intentionally leaked at shutdown). |
| 25 const InstallDetails* g_module_details = nullptr; | 26 const InstallDetails* g_module_details = nullptr; |
| 26 | 27 |
| 27 } // namespace | 28 } // namespace |
| 28 | 29 |
| 30 version_info::Channel InstallDetails::GetChannel() const { |
| 31 #if defined(GOOGLE_CHROME_BUILD) |
| 32 std::wstring channel(channel()); |
| 33 if (channel.empty()) { |
| 34 return version_info::Channel::STABLE; |
| 35 } else if (channel == L"beta") { |
| 36 return version_info::Channel::BETA; |
| 37 } else if (channel == L"dev") { |
| 38 return version_info::Channel::DEV; |
| 39 } else if (channel == L"canary") { |
| 40 return version_info::Channel::CANARY; |
| 41 } |
| 42 #endif |
| 43 |
| 44 return version_info::Channel::UNKNOWN; |
| 45 } |
| 46 |
| 29 std::wstring InstallDetails::GetClientStateKeyPath() const { | 47 std::wstring InstallDetails::GetClientStateKeyPath() const { |
| 30 return install_static::GetClientStateKeyPath(app_guid()); | 48 return install_static::GetClientStateKeyPath(app_guid()); |
| 31 } | 49 } |
| 32 | 50 |
| 33 std::wstring InstallDetails::GetClientStateMediumKeyPath() const { | 51 std::wstring InstallDetails::GetClientStateMediumKeyPath() const { |
| 34 return install_static::GetClientStateMediumKeyPath(app_guid()); | 52 return install_static::GetClientStateMediumKeyPath(app_guid()); |
| 35 } | 53 } |
| 36 | 54 |
| 37 bool InstallDetails::VersionMismatch() const { | 55 bool InstallDetails::VersionMismatch() const { |
| 38 // Check the product version and the size of the mode structure. | 56 // Check the product version and the size of the mode structure. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 g_module_details = install_details.release(); | 99 g_module_details = install_details.release(); |
| 82 return previous_value; | 100 return previous_value; |
| 83 } | 101 } |
| 84 | 102 |
| 85 PrimaryInstallDetails::PrimaryInstallDetails() : InstallDetails(&payload_) { | 103 PrimaryInstallDetails::PrimaryInstallDetails() : InstallDetails(&payload_) { |
| 86 payload_.size = sizeof(payload_); | 104 payload_.size = sizeof(payload_); |
| 87 payload_.product_version = &kProductVersion[0]; | 105 payload_.product_version = &kProductVersion[0]; |
| 88 } | 106 } |
| 89 | 107 |
| 90 } // namespace install_static | 108 } // namespace install_static |
| OLD | NEW |