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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // The friendly name of this Chrome's channel, or an empty string if the | 44 // The friendly name of this Chrome's channel, or an empty string if the |
45 // brand does not integrate with Google Update. | 45 // brand does not integrate with Google Update. |
46 const wchar_t* channel; | 46 const wchar_t* channel; |
47 | 47 |
48 // The string length of |channel| (not including the string terminator). | 48 // The string length of |channel| (not including the string terminator). |
49 size_t channel_length; | 49 size_t channel_length; |
50 | 50 |
51 // True if installed in C:\Program Files{, {x86)}; otherwise, false. | 51 // True if installed in C:\Program Files{, {x86)}; otherwise, false. |
52 bool system_level; | 52 bool system_level; |
53 | |
54 // True if multi-install. | |
55 bool multi_install; | |
56 }; | 53 }; |
57 | 54 |
58 InstallDetails(const InstallDetails&) = delete; | 55 InstallDetails(const InstallDetails&) = delete; |
59 InstallDetails(InstallDetails&&) = delete; | 56 InstallDetails(InstallDetails&&) = delete; |
60 InstallDetails& operator=(const InstallDetails&) = delete; | 57 InstallDetails& operator=(const InstallDetails&) = delete; |
61 virtual ~InstallDetails() = default; | 58 virtual ~InstallDetails() = default; |
62 | 59 |
63 // Returns the instance for this module. | 60 // Returns the instance for this module. |
64 static const InstallDetails& Get(); | 61 static const InstallDetails& Get(); |
65 | 62 |
(...skipping 18 matching lines...) Expand all Loading... |
84 | 81 |
85 // The app GUID with which this mode is registered with Google Update, or an | 82 // The app GUID with which this mode is registered with Google Update, or an |
86 // empty string if this brand does not integrate with Google Update. | 83 // empty string if this brand does not integrate with Google Update. |
87 const wchar_t* app_guid() const { return payload_->mode->app_guid; } | 84 const wchar_t* app_guid() const { return payload_->mode->app_guid; } |
88 | 85 |
89 // True if the mode supports installation at system-level. | 86 // True if the mode supports installation at system-level. |
90 bool supports_system_level() const { | 87 bool supports_system_level() const { |
91 return payload_->mode->supports_system_level; | 88 return payload_->mode->supports_system_level; |
92 } | 89 } |
93 | 90 |
94 // True if the mode supports multi-install. | 91 // True if the mode once supported multi-install. |
95 bool supports_multi_install() const { | 92 bool supported_multi_install() const { |
96 return payload_->mode->supports_multi_install; | 93 return payload_->mode->supported_multi_install; |
97 } | 94 } |
98 | 95 |
99 // The install's update channel, or an empty string if the brand does not | 96 // The install's update channel, or an empty string if the brand does not |
100 // integrate with Google Update. | 97 // integrate with Google Update. |
101 std::wstring channel() const { | 98 std::wstring channel() const { |
102 return std::wstring(payload_->channel, payload_->channel_length); | 99 return std::wstring(payload_->channel, payload_->channel_length); |
103 } | 100 } |
104 bool system_level() const { return payload_->system_level; } | 101 bool system_level() const { return payload_->system_level; } |
105 bool multi_install() const { return payload_->multi_install; } | |
106 | 102 |
107 // Returns the path to the installation's ClientState registry key. Returns | 103 // Returns the path to the installation's ClientState registry key. This |
108 // the path for the binaries if |binaries| and Chrome is | 104 // registry key is used to hold various installation-related values, including |
109 // multi-install. Otherwise, returns the path for Chrome itself. This registry | 105 // an indication of consent for usage stats. |
110 // key is used to hold various installation-related values, including an | 106 std::wstring GetClientStateKeyPath() const; |
111 // indication of consent for usage stats. | |
112 std::wstring GetClientStateKeyPath(bool binaries) const; | |
113 | 107 |
114 // Returns the path to the installation's ClientStateMedium registry key. | 108 // Returns the path to the installation's ClientStateMedium registry key. This |
115 // Returns the path for the binaries if |binaries| and Chrome is | |
116 // multi-install. Otherwise, returns the path for Chrome itself. This | |
117 // registry key is used to hold various installation-related values, including | 109 // registry key is used to hold various installation-related values, including |
118 // an indication of consent for usage stats for a system-level install. | 110 // an indication of consent for usage stats for a system-level install. |
119 std::wstring GetClientStateMediumKeyPath(bool binaries) const; | 111 std::wstring GetClientStateMediumKeyPath() const; |
120 | 112 |
121 // Returns true if there is an indication of a mismatch between the primary | 113 // Returns true if there is an indication of a mismatch between the primary |
122 // module and this module. | 114 // module and this module. |
123 bool VersionMismatch() const; | 115 bool VersionMismatch() const; |
124 | 116 |
125 // Sets the instance for the process. This must be called only once per | 117 // Sets the instance for the process. This must be called only once per |
126 // process during startup. | 118 // process during startup. |
127 static void SetForProcess(std::unique_ptr<PrimaryInstallDetails> details); | 119 static void SetForProcess(std::unique_ptr<PrimaryInstallDetails> details); |
128 | 120 |
129 // Returns a pointer to the module's payload so that it may be shared with | 121 // Returns a pointer to the module's payload so that it may be shared with |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 153 |
162 void set_mode(const InstallConstants* mode) { payload_.mode = mode; } | 154 void set_mode(const InstallConstants* mode) { payload_.mode = mode; } |
163 void set_channel(const std::wstring& channel) { | 155 void set_channel(const std::wstring& channel) { |
164 channel_ = channel; | 156 channel_ = channel; |
165 payload_.channel = channel_.c_str(); | 157 payload_.channel = channel_.c_str(); |
166 payload_.channel_length = channel_.size(); | 158 payload_.channel_length = channel_.size(); |
167 } | 159 } |
168 void set_system_level(bool system_level) { | 160 void set_system_level(bool system_level) { |
169 payload_.system_level = system_level; | 161 payload_.system_level = system_level; |
170 } | 162 } |
171 void set_multi_install(bool multi_install) { | |
172 payload_.multi_install = multi_install; | |
173 } | |
174 | 163 |
175 private: | 164 private: |
176 std::wstring channel_; | 165 std::wstring channel_; |
177 Payload payload_ = Payload(); | 166 Payload payload_ = Payload(); |
178 }; | 167 }; |
179 | 168 |
180 } // namespace install_static | 169 } // namespace install_static |
181 | 170 |
182 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ | 171 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ |
OLD | NEW |