OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ |
6 #define CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ | 6 #define CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Returns false if the value could not be stored. | 109 // Returns false if the value could not be stored. |
110 static bool SetLastRunTime(); | 110 static bool SetLastRunTime(); |
111 | 111 |
112 // Removes the storage used by SetLastRunTime() and SetLastRunTime(). Returns | 112 // Removes the storage used by SetLastRunTime() and SetLastRunTime(). Returns |
113 // false if the operation failed. Returns true if the storage was freed or | 113 // false if the operation failed. Returns true if the storage was freed or |
114 // if it never existed in the first place. | 114 // if it never existed in the first place. |
115 static bool RemoveLastRunTime(); | 115 static bool RemoveLastRunTime(); |
116 | 116 |
117 // Returns in |browser| the browser used to download chrome as recorded | 117 // Returns in |browser| the browser used to download chrome as recorded |
118 // Google Update. Returns false if the information is not available. | 118 // Google Update. Returns false if the information is not available. |
119 static bool GetBrowser(std::wstring* browser); | 119 static bool GetBrowser(base::string16* browser); |
120 | 120 |
121 // Returns in |language| the language selected by the user when downloading | 121 // Returns in |language| the language selected by the user when downloading |
122 // chrome. This information is collected by the web server used to download | 122 // chrome. This information is collected by the web server used to download |
123 // the chrome installer. Returns false if the information is not available. | 123 // the chrome installer. Returns false if the information is not available. |
124 static bool GetLanguage(std::wstring* language); | 124 static bool GetLanguage(base::string16* language); |
125 | 125 |
126 // Returns in |brand| the RLZ brand code or distribution tag that has been | 126 // Returns in |brand| the RLZ brand code or distribution tag that has been |
127 // assigned to a partner. Returns false if the information is not available. | 127 // assigned to a partner. Returns false if the information is not available. |
128 // | 128 // |
129 // NOTE: This function is Windows only. If the code you are writing is not | 129 // NOTE: This function is Windows only. If the code you are writing is not |
130 // specifically for Windows, prefer calling google_brand::GetBrand(). | 130 // specifically for Windows, prefer calling google_brand::GetBrand(). |
131 static bool GetBrand(std::wstring* brand); | 131 static bool GetBrand(base::string16* brand); |
132 | 132 |
133 // Returns in |brand| the RLZ reactivation brand code or distribution tag | 133 // Returns in |brand| the RLZ reactivation brand code or distribution tag |
134 // that has been assigned to a partner for reactivating a dormant chrome | 134 // that has been assigned to a partner for reactivating a dormant chrome |
135 // install. Returns false if the information is not available. | 135 // install. Returns false if the information is not available. |
136 // | 136 // |
137 // NOTE: This function is Windows only. If the code you are writing is not | 137 // NOTE: This function is Windows only. If the code you are writing is not |
138 // specifically for Windows, prefer calling | 138 // specifically for Windows, prefer calling |
139 // google_brand::GetReactivationBrand(). | 139 // google_brand::GetReactivationBrand(). |
140 static bool GetReactivationBrand(std::wstring* brand); | 140 static bool GetReactivationBrand(base::string16* brand); |
141 | 141 |
142 // Returns in |client| the google_update client field, which is currently | 142 // Returns in |client| the google_update client field, which is currently |
143 // used to track experiments. Returns false if the entry does not exist. | 143 // used to track experiments. Returns false if the entry does not exist. |
144 static bool GetClient(std::wstring* client); | 144 static bool GetClient(base::string16* client); |
145 | 145 |
146 // Sets the google_update client field. Unlike GetClient() this is set only | 146 // Sets the google_update client field. Unlike GetClient() this is set only |
147 // for the current user. Returns false if the operation failed. | 147 // for the current user. Returns false if the operation failed. |
148 static bool SetClient(const std::wstring& client); | 148 static bool SetClient(const base::string16& client); |
149 | 149 |
150 // Returns in 'client' the RLZ referral available for some distribution | 150 // Returns in 'client' the RLZ referral available for some distribution |
151 // partners. This value does not exist for most chrome or chromium installs. | 151 // partners. This value does not exist for most chrome or chromium installs. |
152 static bool GetReferral(std::wstring* referral); | 152 static bool GetReferral(base::string16* referral); |
153 | 153 |
154 // Overwrites the current value of the referral with an empty string. Returns | 154 // Overwrites the current value of the referral with an empty string. Returns |
155 // true if this operation succeeded. | 155 // true if this operation succeeded. |
156 static bool ClearReferral(); | 156 static bool ClearReferral(); |
157 | 157 |
158 // Set did_run "dr" in the client state value for app specified by | 158 // Set did_run "dr" in the client state value for app specified by |
159 // |app_reg_data|. This is used to measure active users. Returns false if | 159 // |app_reg_data|. This is used to measure active users. Returns false if |
160 // registry write fails. | 160 // registry write fails. |
161 static bool UpdateDidRunStateForApp(const AppRegistrationData& app_reg_data, | 161 static bool UpdateDidRunStateForApp(const AppRegistrationData& app_reg_data, |
162 bool did_run); | 162 bool did_run); |
(...skipping 22 matching lines...) Expand all Loading... |
185 // it is not present already, so that Google Update server next time will send | 185 // it is not present already, so that Google Update server next time will send |
186 // full installer to update Chrome on the local machine | 186 // full installer to update Chrome on the local machine |
187 // - If we are currently running full installer, we remove this magic | 187 // - If we are currently running full installer, we remove this magic |
188 // string (if it is present) regardless of whether installer failed or not. | 188 // string (if it is present) regardless of whether installer failed or not. |
189 // There is no fall-back for full installer :) | 189 // There is no fall-back for full installer :) |
190 // - Unconditionally remove "-multifail" since we haven't crashed. | 190 // - Unconditionally remove "-multifail" since we haven't crashed. |
191 // |state_key| should be obtained via InstallerState::state_key(). | 191 // |state_key| should be obtained via InstallerState::state_key(). |
192 static void UpdateInstallStatus(bool system_install, | 192 static void UpdateInstallStatus(bool system_install, |
193 installer::ArchiveType archive_type, | 193 installer::ArchiveType archive_type, |
194 int install_return_code, | 194 int install_return_code, |
195 const std::wstring& product_guid); | 195 const base::string16& product_guid); |
196 | 196 |
197 // This method updates the value for Google Update "ap" key for Chrome | 197 // This method updates the value for Google Update "ap" key for Chrome |
198 // based on whether we are doing incremental install (or not) and whether | 198 // based on whether we are doing incremental install (or not) and whether |
199 // the install succeeded. | 199 // the install succeeded. |
200 // - If install worked, remove the magic string (if present). | 200 // - If install worked, remove the magic string (if present). |
201 // - If incremental installer failed, append a magic string (if | 201 // - If incremental installer failed, append a magic string (if |
202 // not present already). | 202 // not present already). |
203 // - If full installer failed, still remove this magic | 203 // - If full installer failed, still remove this magic |
204 // string (if it is present already). | 204 // string (if it is present already). |
205 // | 205 // |
(...skipping 16 matching lines...) Expand all Loading... |
222 // However, when we are about to switch contexts from system to user, we can | 222 // However, when we are about to switch contexts from system to user, we can |
223 // duplicate the handle to the registry key and pass it (through handle | 223 // duplicate the handle to the registry key and pass it (through handle |
224 // inheritance) to the newly created child process that is launched as the | 224 // inheritance) to the newly created child process that is launched as the |
225 // user, allowing the child process to write to the key, with the | 225 // user, allowing the child process to write to the key, with the |
226 // WriteGoogleUpdateSystemClientKey function below. | 226 // WriteGoogleUpdateSystemClientKey function below. |
227 static int DuplicateGoogleUpdateSystemClientKey(); | 227 static int DuplicateGoogleUpdateSystemClientKey(); |
228 | 228 |
229 // Takes a |handle| to a registry key and writes |value| string into the | 229 // Takes a |handle| to a registry key and writes |value| string into the |
230 // specified |key|. See DuplicateGoogleUpdateSystemClientKey for details. | 230 // specified |key|. See DuplicateGoogleUpdateSystemClientKey for details. |
231 static bool WriteGoogleUpdateSystemClientKey(int handle, | 231 static bool WriteGoogleUpdateSystemClientKey(int handle, |
232 const std::wstring& key, | 232 const base::string16& key, |
233 const std::wstring& value); | 233 const base::string16& value); |
234 | 234 |
235 // Returns the effective update policy for |app_guid| as dictated by | 235 // Returns the effective update policy for |app_guid| as dictated by |
236 // Group Policy settings. |is_overridden|, if non-NULL, is populated with | 236 // Group Policy settings. |is_overridden|, if non-NULL, is populated with |
237 // true if an app-specific policy override is in force, or false otherwise. | 237 // true if an app-specific policy override is in force, or false otherwise. |
238 static UpdatePolicy GetAppUpdatePolicy(const std::wstring& app_guid, | 238 static UpdatePolicy GetAppUpdatePolicy(const base::string16& app_guid, |
239 bool* is_overridden); | 239 bool* is_overridden); |
240 | 240 |
241 // Returns true if the app indicated by |app_guid| should be updated | 241 // Returns true if the app indicated by |app_guid| should be updated |
242 // automatically by Google Update based on current autoupdate settings. This | 242 // automatically by Google Update based on current autoupdate settings. This |
243 // is distinct from GetApUpdatePolicy which checks only a subset of things | 243 // is distinct from GetApUpdatePolicy which checks only a subset of things |
244 // that can cause an app not to update. | 244 // that can cause an app not to update. |
245 static bool AreAutoupdatesEnabled(const base::string16& app_guid); | 245 static bool AreAutoupdatesEnabled(const base::string16& app_guid); |
246 | 246 |
247 // Attempts to reenable auto-updates for |app_guid| by removing | 247 // Attempts to reenable auto-updates for |app_guid| by removing |
248 // any group policy settings that would block updates from occurring. This is | 248 // any group policy settings that would block updates from occurring. This is |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // this will do nothing to |experiment_labels|. This will return true if the | 306 // this will do nothing to |experiment_labels|. This will return true if the |
307 // label did not exist, or was successfully read. | 307 // label did not exist, or was successfully read. |
308 static bool ReadExperimentLabels(bool system_install, | 308 static bool ReadExperimentLabels(bool system_install, |
309 base::string16* experiment_labels); | 309 base::string16* experiment_labels); |
310 | 310 |
311 private: | 311 private: |
312 DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings); | 312 DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings); |
313 }; | 313 }; |
314 | 314 |
315 #endif // CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ | 315 #endif // CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_SETTINGS_H_ |
OLD | NEW |