OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Base class for managing an action of a sequence of actions to be carried | 5 // Base class for managing an action of a sequence of actions to be carried |
6 // out during install/update/uninstall. Supports rollback of actions if this | 6 // out during install/update/uninstall. Supports rollback of actions if this |
7 // process fails. | 7 // process fails. |
8 | 8 |
9 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 9 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
10 #define CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 10 #define CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
(...skipping 19 matching lines...) Expand all Loading... |
30 class WorkItemList; | 30 class WorkItemList; |
31 | 31 |
32 namespace base { | 32 namespace base { |
33 class FilePath; | 33 class FilePath; |
34 } | 34 } |
35 | 35 |
36 // A base class that defines APIs to perform/rollback an action or a | 36 // A base class that defines APIs to perform/rollback an action or a |
37 // sequence of actions during install/update/uninstall. | 37 // sequence of actions during install/update/uninstall. |
38 class WorkItem { | 38 class WorkItem { |
39 public: | 39 public: |
| 40 // A callback that returns the desired value based on the |existing_value|. |
| 41 // |existing_value| will be empty if the value didn't previously exist or |
| 42 // existed under a non-string type. |
| 43 using GetValueFromExistingCallback = |
| 44 base::Callback<std::wstring(const std::wstring& existing_value)>; |
| 45 |
40 // All registry operations can be instructed to operate on a specific view | 46 // All registry operations can be instructed to operate on a specific view |
41 // of the registry by specifying a REGSAM value to the wow64_access parameter. | 47 // of the registry by specifying a REGSAM value to the wow64_access parameter. |
42 // The wow64_access parameter can be one of: | 48 // The wow64_access parameter can be one of: |
43 // KEY_WOW64_32KEY - Operate on the 32-bit view. | 49 // KEY_WOW64_32KEY - Operate on the 32-bit view. |
44 // KEY_WOW64_64KEY - Operate on the 64-bit view. | 50 // KEY_WOW64_64KEY - Operate on the 64-bit view. |
45 // kWow64Default - Operate on the default view (e.g. 32-bit on 32-bit | 51 // kWow64Default - Operate on the default view (e.g. 32-bit on 32-bit |
46 // systems, and 64-bit on 64-bit systems). | 52 // systems, and 64-bit on 64-bit systems). |
47 // See http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129.aspx | 53 // See http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129.aspx |
48 static const REGSAM kWow64Default = 0; | 54 static const REGSAM kWow64Default = 0; |
49 // Possible states | 55 // Possible states |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Create a SetRegValueWorkItem that sets a registry value with REG_QWORD type | 157 // Create a SetRegValueWorkItem that sets a registry value with REG_QWORD type |
152 // at the key with specified path. | 158 // at the key with specified path. |
153 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 159 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
154 HKEY predefined_root, | 160 HKEY predefined_root, |
155 const std::wstring& key_path, | 161 const std::wstring& key_path, |
156 REGSAM wow64_access, | 162 REGSAM wow64_access, |
157 const std::wstring& value_name, | 163 const std::wstring& value_name, |
158 int64 value_data, | 164 int64 value_data, |
159 bool overwrite); | 165 bool overwrite); |
160 | 166 |
| 167 // Create a SetRegValueWorkItem that sets a registry value based on the value |
| 168 // provided by |get_value_callback| given the existing value under |
| 169 // |key_path\value_name|. |
| 170 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
| 171 HKEY predefined_root, |
| 172 const std::wstring& key_path, |
| 173 REGSAM wow64_access, |
| 174 const std::wstring& value_name, |
| 175 const GetValueFromExistingCallback& get_value_callback); |
| 176 |
161 // Add a SelfRegWorkItem that registers or unregisters a DLL at the | 177 // Add a SelfRegWorkItem that registers or unregisters a DLL at the |
162 // specified path. | 178 // specified path. |
163 static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path, | 179 static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path, |
164 bool do_register, | 180 bool do_register, |
165 bool user_level_registration); | 181 bool user_level_registration); |
166 | 182 |
167 // Create an empty WorkItemList. A WorkItemList can recursively contains | 183 // Create an empty WorkItemList. A WorkItemList can recursively contains |
168 // a list of WorkItems. | 184 // a list of WorkItems. |
169 static WorkItemList* CreateWorkItemList(); | 185 static WorkItemList* CreateWorkItemList(); |
170 | 186 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 WorkItem(); | 230 WorkItem(); |
215 | 231 |
216 // Specifies whether this work item my fail to complete and yet still | 232 // Specifies whether this work item my fail to complete and yet still |
217 // return true from Do(). | 233 // return true from Do(). |
218 bool ignore_failure_; | 234 bool ignore_failure_; |
219 | 235 |
220 std::string log_message_; | 236 std::string log_message_; |
221 }; | 237 }; |
222 | 238 |
223 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 239 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
OLD | NEW |