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 29 matching lines...) Expand all Loading... | |
40 // The brand-specific install mode for this install; see kInstallModes. | 40 // The brand-specific install mode for this install; see kInstallModes. |
41 const InstallConstants* mode; | 41 const InstallConstants* mode; |
42 | 42 |
43 // The friendly name of this Chrome's channel, or an empty string if the | 43 // The friendly name of this Chrome's channel, or an empty string if the |
44 // brand does not integrate with Google Update. | 44 // brand does not integrate with Google Update. |
45 const wchar_t* channel; | 45 const wchar_t* channel; |
46 | 46 |
47 // The string length of |channel| (not including the string terminator). | 47 // The string length of |channel| (not including the string terminator). |
48 size_t channel_length; | 48 size_t channel_length; |
49 | 49 |
50 // The user data dir in use for this process. | |
51 const wchar_t* user_data_dir; | |
52 | |
53 // The string length of |user_data_dir| (not including the string | |
54 // terminator). | |
55 size_t user_data_dir_length; | |
56 | |
57 // The invalid user data dir in use for this process. This is set only when | |
58 // the user specified an unusable directory for the user data directory. It | |
59 // is saved off before the user data dir is replaced with a valid one, to be | |
60 // used later for an error dialog for the user. | |
61 const wchar_t* invalid_user_data_dir; | |
62 | |
63 // The string length of |invalid_user_data_dir| (not including the string | |
64 // terminator). | |
65 size_t invalid_user_data_dir_length; | |
66 | |
50 // True if installed in C:\Program Files{, {x86)}; otherwise, false. | 67 // True if installed in C:\Program Files{, {x86)}; otherwise, false. |
51 bool system_level; | 68 bool system_level; |
52 | 69 |
53 // True if multi-install. | 70 // True if multi-install. |
54 bool multi_install; | 71 bool multi_install; |
55 }; | 72 }; |
56 | 73 |
57 InstallDetails(const InstallDetails&) = delete; | 74 InstallDetails(const InstallDetails&) = delete; |
58 InstallDetails(InstallDetails&&) = delete; | 75 InstallDetails(InstallDetails&&) = delete; |
59 InstallDetails& operator=(const InstallDetails&) = delete; | 76 InstallDetails& operator=(const InstallDetails&) = delete; |
(...skipping 24 matching lines...) Expand all Loading... | |
84 // True if the mode supports multi-install. | 101 // True if the mode supports multi-install. |
85 bool supports_multi_install() const { | 102 bool supports_multi_install() const { |
86 return payload_->mode->supports_multi_install; | 103 return payload_->mode->supports_multi_install; |
87 } | 104 } |
88 | 105 |
89 // The install's update channel, or an empty string if the brand does not | 106 // The install's update channel, or an empty string if the brand does not |
90 // integrate with Google Update. | 107 // integrate with Google Update. |
91 std::wstring channel() const { | 108 std::wstring channel() const { |
92 return std::wstring(payload_->channel, payload_->channel_length); | 109 return std::wstring(payload_->channel, payload_->channel_length); |
93 } | 110 } |
111 std::wstring user_data_dir() const { | |
112 return std::wstring(payload_->user_data_dir, | |
113 payload_->user_data_dir_length); | |
114 } | |
115 std::wstring invalid_user_data_dir() const { | |
116 if (!payload_->invalid_user_data_dir) | |
117 return std::wstring(); | |
118 return std::wstring(payload_->invalid_user_data_dir, | |
119 payload_->invalid_user_data_dir_length); | |
120 } | |
94 bool system_level() const { return payload_->system_level; } | 121 bool system_level() const { return payload_->system_level; } |
95 bool multi_install() const { return payload_->multi_install; } | 122 bool multi_install() const { return payload_->multi_install; } |
96 | 123 |
97 // Returns the path to the installation's ClientState registry key. Returns | 124 // Returns the path to the installation's ClientState registry key. Returns |
98 // the path for the binaries if |binaries| and Chrome is | 125 // the path for the binaries if |binaries| and Chrome is |
99 // multi-install. Otherwise, returns the path for Chrome itself. This registry | 126 // multi-install. Otherwise, returns the path for Chrome itself. This registry |
100 // key is used to hold various installation-related values, including an | 127 // key is used to hold various installation-related values, including an |
101 // indication of consent for usage stats. | 128 // indication of consent for usage stats. |
102 std::wstring GetClientStateKeyPath(bool binaries) const; | 129 std::wstring GetClientStateKeyPath(bool binaries) const; |
103 | 130 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 PrimaryInstallDetails(const PrimaryInstallDetails&) = delete; | 175 PrimaryInstallDetails(const PrimaryInstallDetails&) = delete; |
149 PrimaryInstallDetails(PrimaryInstallDetails&&) = delete; | 176 PrimaryInstallDetails(PrimaryInstallDetails&&) = delete; |
150 PrimaryInstallDetails& operator=(const PrimaryInstallDetails&) = delete; | 177 PrimaryInstallDetails& operator=(const PrimaryInstallDetails&) = delete; |
151 | 178 |
152 void set_mode(const InstallConstants* mode) { payload_.mode = mode; } | 179 void set_mode(const InstallConstants* mode) { payload_.mode = mode; } |
153 void set_channel(const std::wstring& channel) { | 180 void set_channel(const std::wstring& channel) { |
154 channel_ = channel; | 181 channel_ = channel; |
155 payload_.channel = channel_.c_str(); | 182 payload_.channel = channel_.c_str(); |
156 payload_.channel_length = channel_.size(); | 183 payload_.channel_length = channel_.size(); |
157 } | 184 } |
185 void set_user_data_dir(const std::wstring& user_data_dir) { | |
186 user_data_dir_ = user_data_dir; | |
187 payload_.user_data_dir = user_data_dir_.c_str(); | |
188 payload_.user_data_dir_length = user_data_dir_.size(); | |
189 } | |
190 void set_invalid_user_data_dir(const std::wstring& invalid_user_data_dir) { | |
191 invalid_user_data_dir_ = invalid_user_data_dir; | |
192 payload_.invalid_user_data_dir = invalid_user_data_dir_.c_str(); | |
193 payload_.invalid_user_data_dir_length = invalid_user_data_dir_.size(); | |
194 } | |
158 void set_system_level(bool system_level) { | 195 void set_system_level(bool system_level) { |
159 payload_.system_level = system_level; | 196 payload_.system_level = system_level; |
160 } | 197 } |
161 void set_multi_install(bool multi_install) { | 198 void set_multi_install(bool multi_install) { |
162 payload_.multi_install = multi_install; | 199 payload_.multi_install = multi_install; |
163 } | 200 } |
164 | 201 |
202 static PrimaryInstallDetails* GetMutable(); | |
scottmg
2016/11/18 20:48:27
I assume you will dislike this solution, but I did
| |
203 | |
165 private: | 204 private: |
166 std::wstring channel_; | 205 std::wstring channel_; |
206 std::wstring user_data_dir_; | |
207 std::wstring invalid_user_data_dir_; | |
167 Payload payload_ = Payload(); | 208 Payload payload_ = Payload(); |
168 }; | 209 }; |
169 | 210 |
170 } // namespace install_static | 211 } // namespace install_static |
171 | 212 |
172 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ | 213 #endif // CHROME_INSTALL_STATIC_INSTALL_DETAILS_H_ |
OLD | NEW |