| 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/version_info_values.h" | 15 #include "components/version_info/version_info_values.h" |
| 16 | 16 |
| 17 namespace install_static { | 17 namespace install_static { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // The version is set at compile-time to a W.X.Y.Z value. | 21 // The version is set at compile-time to a W.X.Y.Z value. |
| 22 constexpr char kProductVersion[] = PRODUCT_VERSION; | 22 constexpr char kProductVersion[] = PRODUCT_VERSION; |
| 23 | 23 |
| 24 // This module's instance (intentionally leaked at shutdown). | 24 // This module's instance (intentionally leaked at shutdown). |
| 25 InstallDetails* g_module_details = nullptr; | 25 InstallDetails* g_module_details = nullptr; |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 std::wstring InstallDetails::GetClientStateKeyPath(bool binaries) const { | 29 std::wstring InstallDetails::GetClientStateKeyPath() const { |
| 30 return binaries && multi_install() | 30 return install_static::GetClientStateKeyPath(app_guid()); |
| 31 ? GetBinariesClientStateKeyPath() | |
| 32 : install_static::GetClientStateKeyPath(app_guid()); | |
| 33 } | 31 } |
| 34 | 32 |
| 35 std::wstring InstallDetails::GetClientStateMediumKeyPath(bool binaries) const { | 33 std::wstring InstallDetails::GetClientStateMediumKeyPath() const { |
| 36 return binaries && multi_install() | 34 return install_static::GetClientStateMediumKeyPath(app_guid()); |
| 37 ? GetBinariesClientStateMediumKeyPath() | |
| 38 : install_static::GetClientStateMediumKeyPath(app_guid()); | |
| 39 } | 35 } |
| 40 | 36 |
| 41 bool InstallDetails::VersionMismatch() const { | 37 bool InstallDetails::VersionMismatch() const { |
| 42 // Check the product version and the size of the mode structure. | 38 // Check the product version and the size of the mode structure. |
| 43 return payload_->size != sizeof(Payload) || | 39 return payload_->size != sizeof(Payload) || |
| 44 strcmp(payload_->product_version, &kProductVersion[0]) != 0 || | 40 strcmp(payload_->product_version, &kProductVersion[0]) != 0 || |
| 45 payload_->mode->size != sizeof(InstallConstants); | 41 payload_->mode->size != sizeof(InstallConstants); |
| 46 } | 42 } |
| 47 | 43 |
| 48 // static | 44 // static |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Intentionally leaked at shutdown. | 78 // Intentionally leaked at shutdown. |
| 83 g_module_details = new InstallDetails(payload_getter()); | 79 g_module_details = new InstallDetails(payload_getter()); |
| 84 } | 80 } |
| 85 | 81 |
| 86 PrimaryInstallDetails::PrimaryInstallDetails() : InstallDetails(&payload_) { | 82 PrimaryInstallDetails::PrimaryInstallDetails() : InstallDetails(&payload_) { |
| 87 payload_.size = sizeof(payload_); | 83 payload_.size = sizeof(payload_); |
| 88 payload_.product_version = &kProductVersion[0]; | 84 payload_.product_version = &kProductVersion[0]; |
| 89 } | 85 } |
| 90 | 86 |
| 91 } // namespace install_static | 87 } // namespace install_static |
| OLD | NEW |