| 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 #ifndef CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ | 5 #ifndef CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ |
| 6 #define CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ | 6 #define CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 InstallDetails& operator=(const InstallDetails&) = delete; | 58 InstallDetails& operator=(const InstallDetails&) = delete; |
| 59 virtual ~InstallDetails() = default; | 59 virtual ~InstallDetails() = default; |
| 60 | 60 |
| 61 // Returns the instance for this module. | 61 // Returns the instance for this module. |
| 62 static const InstallDetails& Get(); | 62 static const InstallDetails& Get(); |
| 63 | 63 |
| 64 // This mode's index into the brand's array of install modes. This will match | 64 // This mode's index into the brand's array of install modes. This will match |
| 65 // a brand-specific InstallConstantIndex enumerator. | 65 // a brand-specific InstallConstantIndex enumerator. |
| 66 int install_mode_index() const { return payload_->mode->index; } | 66 int install_mode_index() const { return payload_->mode->index; } |
| 67 | 67 |
| 68 // Returns true if the current mode is the brand's primary install mode rather |
| 69 // than one of its secondary modes (e.g., canary Chrome). |
| 70 bool is_primary_mode() const { return install_mode_index() == 0; } |
| 71 |
| 68 // The mode's install suffix (e.g., " SxS" for canary Chrome), or an empty | 72 // The mode's install suffix (e.g., " SxS" for canary Chrome), or an empty |
| 69 // string for a brand's primary install mode. | 73 // string for a brand's primary install mode. |
| 70 const wchar_t* install_suffix() const { | 74 const wchar_t* install_suffix() const { |
| 71 return payload_->mode->install_suffix; | 75 return payload_->mode->install_suffix; |
| 72 } | 76 } |
| 73 | 77 |
| 78 // The mode's logo suffix (e.g., "Canary" for canary Chrome), or an empty |
| 79 // string for a brand's primary install mode. |
| 80 const wchar_t* logo_suffix() const { return payload_->mode->logo_suffix; } |
| 81 |
| 74 // Returns the full name of the installed product (e.g. "Chrome SxS" for | 82 // Returns the full name of the installed product (e.g. "Chrome SxS" for |
| 75 // canary chrome). | 83 // canary chrome). |
| 76 std::wstring install_full_name() const { | 84 std::wstring install_full_name() const { |
| 77 return std::wstring(kProductPathName, kProductPathNameLength) | 85 return std::wstring(kProductPathName, kProductPathNameLength) |
| 78 .append(install_suffix()); | 86 .append(install_suffix()); |
| 79 } | 87 } |
| 80 | 88 |
| 81 const InstallConstants& mode() const { return *payload_->mode; } | 89 const InstallConstants& mode() const { return *payload_->mode; } |
| 82 | 90 |
| 83 // The app GUID with which this mode is registered with Google Update, or an | 91 // The app GUID with which this mode is registered with Google Update, or an |
| 84 // empty string if this brand does not integrate with Google Update. | 92 // empty string if this brand does not integrate with Google Update. |
| 85 const wchar_t* app_guid() const { return payload_->mode->app_guid; } | 93 const wchar_t* app_guid() const { return payload_->mode->app_guid; } |
| 86 | 94 |
| 87 // True if the mode supports installation at system-level. | 95 // True if the mode supports installation at system-level. |
| 88 bool supports_system_level() const { | 96 bool supports_system_level() const { |
| 89 return payload_->mode->supports_system_level; | 97 return payload_->mode->supports_system_level; |
| 90 } | 98 } |
| 91 | 99 |
| 92 // True if the mode once supported multi-install. | 100 // True if the mode once supported multi-install, a legacy mode of |
| 101 // installation. This exists to provide migration and cleanup for older |
| 102 // installs. |
| 93 bool supported_multi_install() const { | 103 bool supported_multi_install() const { |
| 94 return payload_->mode->supported_multi_install; | 104 return payload_->mode->supported_multi_install; |
| 95 } | 105 } |
| 96 | 106 |
| 97 // The install's update channel, or an empty string if the brand does not | 107 // The install's update channel, or an empty string if the brand does not |
| 98 // integrate with Google Update. | 108 // integrate with Google Update. |
| 99 std::wstring channel() const { | 109 std::wstring channel() const { |
| 100 return std::wstring(payload_->channel, payload_->channel_length); | 110 return std::wstring(payload_->channel, payload_->channel_length); |
| 101 } | 111 } |
| 102 bool system_level() const { return payload_->system_level; } | 112 bool system_level() const { return payload_->system_level; } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 177 } |
| 168 | 178 |
| 169 private: | 179 private: |
| 170 std::wstring channel_; | 180 std::wstring channel_; |
| 171 Payload payload_ = Payload(); | 181 Payload payload_ = Payload(); |
| 172 }; | 182 }; |
| 173 | 183 |
| 174 } // namespace install_static | 184 } // namespace install_static |
| 175 | 185 |
| 176 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ | 186 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ |
| OLD | NEW |