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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // The brand-specific install mode for this install; see kInstallModes. | 42 // The brand-specific install mode for this install; see kInstallModes. |
43 const InstallConstants* mode; | 43 const InstallConstants* mode; |
44 | 44 |
45 // The friendly name of this Chrome's channel, or an empty string if the | 45 // The friendly name of this Chrome's channel, or an empty string if the |
46 // brand does not integrate with Google Update. | 46 // brand does not integrate with Google Update. |
47 const wchar_t* channel; | 47 const wchar_t* channel; |
48 | 48 |
49 // The string length of |channel| (not including the string terminator). | 49 // The string length of |channel| (not including the string terminator). |
50 size_t channel_length; | 50 size_t channel_length; |
51 | 51 |
| 52 // The "ap" (additional parameters) value read from Chrome's ClientState key |
| 53 // during process startup. |
| 54 const wchar_t* update_ap; |
| 55 |
| 56 // The "name" value read from Chrome's ClientState\cohort key during process |
| 57 // startup. |
| 58 const wchar_t* update_cohort_name; |
| 59 |
52 // True if installed in C:\Program Files{, {x86)}; otherwise, false. | 60 // True if installed in C:\Program Files{, {x86)}; otherwise, false. |
53 bool system_level; | 61 bool system_level; |
54 }; | 62 }; |
55 | 63 |
56 InstallDetails(const InstallDetails&) = delete; | 64 InstallDetails(const InstallDetails&) = delete; |
57 InstallDetails(InstallDetails&&) = delete; | 65 InstallDetails(InstallDetails&&) = delete; |
58 InstallDetails& operator=(const InstallDetails&) = delete; | 66 InstallDetails& operator=(const InstallDetails&) = delete; |
59 virtual ~InstallDetails() = default; | 67 virtual ~InstallDetails() = default; |
60 | 68 |
61 // Returns the instance for this module. | 69 // Returns the instance for this module. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Returns the resource id of this mode's main application icon. | 127 // Returns the resource id of this mode's main application icon. |
120 int32_t app_icon_resource_id() const { | 128 int32_t app_icon_resource_id() const { |
121 return payload_->mode->app_icon_resource_id; | 129 return payload_->mode->app_icon_resource_id; |
122 } | 130 } |
123 | 131 |
124 // The install's update channel, or an empty string if the brand does not | 132 // The install's update channel, or an empty string if the brand does not |
125 // integrate with Google Update. | 133 // integrate with Google Update. |
126 std::wstring channel() const { | 134 std::wstring channel() const { |
127 return std::wstring(payload_->channel, payload_->channel_length); | 135 return std::wstring(payload_->channel, payload_->channel_length); |
128 } | 136 } |
| 137 |
| 138 // Returns the "ap" (additional parameters) value read from Chrome's |
| 139 // ClientState key during process startup. |
| 140 std::wstring update_ap() const { |
| 141 return payload_->update_ap ? std::wstring(payload_->update_ap) |
| 142 : std::wstring(); |
| 143 } |
| 144 |
| 145 // Returns the "name" value read from Chrome's ClientState\cohort key during |
| 146 // process startup. |
| 147 std::wstring update_cohort_name() const { |
| 148 return payload_->update_cohort_name |
| 149 ? std::wstring(payload_->update_cohort_name) |
| 150 : std::wstring(); |
| 151 } |
| 152 |
129 bool system_level() const { return payload_->system_level; } | 153 bool system_level() const { return payload_->system_level; } |
130 | 154 |
131 // Returns the path to the installation's ClientState registry key. This | 155 // Returns the path to the installation's ClientState registry key. This |
132 // registry key is used to hold various installation-related values, including | 156 // registry key is used to hold various installation-related values, including |
133 // an indication of consent for usage stats. | 157 // an indication of consent for usage stats. |
134 std::wstring GetClientStateKeyPath() const; | 158 std::wstring GetClientStateKeyPath() const; |
135 | 159 |
136 // Returns the path to the installation's ClientStateMedium registry key. This | 160 // Returns the path to the installation's ClientStateMedium registry key. This |
137 // registry key is used to hold various installation-related values, including | 161 // registry key is used to hold various installation-related values, including |
138 // an indication of consent for usage stats for a system-level install. | 162 // an indication of consent for usage stats for a system-level install. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 PrimaryInstallDetails(const PrimaryInstallDetails&) = delete; | 206 PrimaryInstallDetails(const PrimaryInstallDetails&) = delete; |
183 PrimaryInstallDetails(PrimaryInstallDetails&&) = delete; | 207 PrimaryInstallDetails(PrimaryInstallDetails&&) = delete; |
184 PrimaryInstallDetails& operator=(const PrimaryInstallDetails&) = delete; | 208 PrimaryInstallDetails& operator=(const PrimaryInstallDetails&) = delete; |
185 | 209 |
186 void set_mode(const InstallConstants* mode) { payload_.mode = mode; } | 210 void set_mode(const InstallConstants* mode) { payload_.mode = mode; } |
187 void set_channel(const std::wstring& channel) { | 211 void set_channel(const std::wstring& channel) { |
188 channel_ = channel; | 212 channel_ = channel; |
189 payload_.channel = channel_.c_str(); | 213 payload_.channel = channel_.c_str(); |
190 payload_.channel_length = channel_.size(); | 214 payload_.channel_length = channel_.size(); |
191 } | 215 } |
| 216 void set_update_ap(const std::wstring& update_ap) { |
| 217 update_ap_ = update_ap; |
| 218 payload_.update_ap = update_ap_.c_str(); |
| 219 } |
| 220 void set_update_cohort_name(const std::wstring& update_cohort_name) { |
| 221 update_cohort_name_ = update_cohort_name; |
| 222 payload_.update_cohort_name = update_cohort_name_.c_str(); |
| 223 } |
192 void set_system_level(bool system_level) { | 224 void set_system_level(bool system_level) { |
193 payload_.system_level = system_level; | 225 payload_.system_level = system_level; |
194 } | 226 } |
195 | 227 |
196 private: | 228 private: |
197 std::wstring channel_; | 229 std::wstring channel_; |
| 230 std::wstring update_ap_; |
| 231 std::wstring update_cohort_name_; |
198 Payload payload_ = Payload(); | 232 Payload payload_ = Payload(); |
199 }; | 233 }; |
200 | 234 |
201 } // namespace install_static | 235 } // namespace install_static |
202 | 236 |
203 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ | 237 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ |
OLD | NEW |