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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 IF_NOT_PRESENT, // Copy only if file/directory do not exist already. | 46 IF_NOT_PRESENT, // Copy only if file/directory do not exist already. |
47 NEW_NAME_IF_IN_USE // Copy to a new path if dest is in use(only files). | 47 NEW_NAME_IF_IN_USE // Copy to a new path if dest is in use(only files). |
48 }; | 48 }; |
49 | 49 |
50 // Options for the MoveTree work item. | 50 // Options for the MoveTree work item. |
51 enum MoveTreeOption { | 51 enum MoveTreeOption { |
52 ALWAYS_MOVE, // Always attempt to do a move operation. | 52 ALWAYS_MOVE, // Always attempt to do a move operation. |
53 CHECK_DUPLICATES // Only move if the move target is different. | 53 CHECK_DUPLICATES // Only move if the move target is different. |
54 }; | 54 }; |
55 | 55 |
| 56 enum RegWow64ViewOption { |
| 57 WOW64_DEFAULT, // Use default view for specified key. |
| 58 WOW64_64KEY, // Always attempt to access the 64-bit registry view. |
| 59 WOW64_32KEY // Always attempt to access the 32-bit registry view. |
| 60 }; |
| 61 |
56 // Abstract base class for the conditions used by ConditionWorkItemList. | 62 // Abstract base class for the conditions used by ConditionWorkItemList. |
57 // TODO(robertshield): Move this out of WorkItem. | 63 // TODO(robertshield): Move this out of WorkItem. |
58 class Condition { | 64 class Condition { |
59 public: | 65 public: |
60 virtual ~Condition() {} | 66 virtual ~Condition() {} |
61 virtual bool ShouldRun() const = 0; | 67 virtual bool ShouldRun() const = 0; |
62 }; | 68 }; |
63 | 69 |
64 virtual ~WorkItem(); | 70 virtual ~WorkItem(); |
65 | 71 |
66 // Create a CallbackWorkItem that invokes a callback. | 72 // Create a CallbackWorkItem that invokes a callback. |
67 static CallbackWorkItem* CreateCallbackWorkItem( | 73 static CallbackWorkItem* CreateCallbackWorkItem( |
68 base::Callback<bool(const CallbackWorkItem&)> callback); | 74 base::Callback<bool(const CallbackWorkItem&)> callback); |
69 | 75 |
70 // Create a CopyRegKeyWorkItem that recursively copies a given registry key. | 76 // Create a CopyRegKeyWorkItem that recursively copies a given registry key. |
71 static CopyRegKeyWorkItem* CreateCopyRegKeyWorkItem( | 77 static CopyRegKeyWorkItem* CreateCopyRegKeyWorkItem( |
72 HKEY predefined_root, | 78 HKEY predefined_root, |
73 const std::wstring& source_key_path, | 79 const std::wstring& source_key_path, |
74 const std::wstring& dest_key_path, | 80 const std::wstring& dest_key_path, |
75 CopyOverWriteOption overwrite_option); | 81 CopyOverWriteOption overwrite_option, |
| 82 RegWow64ViewOption reg_wow64_option); |
76 | 83 |
77 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy | 84 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy |
78 // from source path to destination path. | 85 // from source path to destination path. |
79 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always | 86 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always |
80 // overwrites files. | 87 // overwrites files. |
81 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an | 88 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an |
82 // alternate name specified by alternative_path. | 89 // alternate name specified by alternative_path. |
83 static CopyTreeWorkItem* CreateCopyTreeWorkItem( | 90 static CopyTreeWorkItem* CreateCopyTreeWorkItem( |
84 const base::FilePath& source_path, | 91 const base::FilePath& source_path, |
85 const base::FilePath& dest_path, | 92 const base::FilePath& dest_path, |
86 const base::FilePath& temp_dir, | 93 const base::FilePath& temp_dir, |
87 CopyOverWriteOption overwrite_option, | 94 CopyOverWriteOption overwrite_option, |
88 const base::FilePath& alternative_path); | 95 const base::FilePath& alternative_path); |
89 | 96 |
90 // Create a CreateDirWorkItem that creates a directory at the given path. | 97 // Create a CreateDirWorkItem that creates a directory at the given path. |
91 static CreateDirWorkItem* CreateCreateDirWorkItem(const base::FilePath& path); | 98 static CreateDirWorkItem* CreateCreateDirWorkItem(const base::FilePath& path); |
92 | 99 |
93 // Create a CreateRegKeyWorkItem that creates a registry key at the given | 100 // Create a CreateRegKeyWorkItem that creates a registry key at the given |
94 // path. | 101 // path. |
95 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem( | 102 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem( |
96 HKEY predefined_root, const std::wstring& path); | 103 HKEY predefined_root, const std::wstring& path, |
| 104 RegWow64ViewOption reg_wow64_option); |
97 | 105 |
98 // Create a DeleteRegKeyWorkItem that deletes a registry key at the given | 106 // Create a DeleteRegKeyWorkItem that deletes a registry key at the given |
99 // path. | 107 // path. |
100 static DeleteRegKeyWorkItem* CreateDeleteRegKeyWorkItem( | 108 static DeleteRegKeyWorkItem* CreateDeleteRegKeyWorkItem( |
101 HKEY predefined_root, const std::wstring& path); | 109 HKEY predefined_root, |
| 110 const std::wstring& path, |
| 111 RegWow64ViewOption reg_wow64_option); |
102 | 112 |
103 // Create a DeleteRegValueWorkItem that deletes a registry value | 113 // Create a DeleteRegValueWorkItem that deletes a registry value |
104 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem( | 114 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem( |
105 HKEY predefined_root, | 115 HKEY predefined_root, |
106 const std::wstring& key_path, | 116 const std::wstring& key_path, |
107 const std::wstring& value_name); | 117 const std::wstring& value_name, |
| 118 RegWow64ViewOption reg_wow64_option); |
108 | 119 |
109 // Create a DeleteTreeWorkItem that recursively deletes a file system | 120 // Create a DeleteTreeWorkItem that recursively deletes a file system |
110 // hierarchy at the given root path. A key file can be optionally specified | 121 // hierarchy at the given root path. A key file can be optionally specified |
111 // by key_path. | 122 // by key_path. |
112 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem( | 123 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem( |
113 const base::FilePath& root_path, | 124 const base::FilePath& root_path, |
114 const base::FilePath& temp_path, | 125 const base::FilePath& temp_path, |
115 const std::vector<base::FilePath>& key_paths); | 126 const std::vector<base::FilePath>& key_paths); |
116 | 127 |
117 // Create a MoveTreeWorkItem that recursively moves a file system hierarchy | 128 // Create a MoveTreeWorkItem that recursively moves a file system hierarchy |
118 // from source path to destination path. | 129 // from source path to destination path. |
119 static MoveTreeWorkItem* CreateMoveTreeWorkItem( | 130 static MoveTreeWorkItem* CreateMoveTreeWorkItem( |
120 const base::FilePath& source_path, | 131 const base::FilePath& source_path, |
121 const base::FilePath& dest_path, | 132 const base::FilePath& dest_path, |
122 const base::FilePath& temp_dir, | 133 const base::FilePath& temp_dir, |
123 MoveTreeOption duplicate_option); | 134 MoveTreeOption duplicate_option); |
124 | 135 |
125 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type | 136 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type |
126 // at the key with specified path. | 137 // at the key with specified path. |
127 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 138 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
128 HKEY predefined_root, | 139 HKEY predefined_root, |
129 const std::wstring& key_path, | 140 const std::wstring& key_path, |
130 const std::wstring& value_name, | 141 const std::wstring& value_name, |
131 const std::wstring& value_data, | 142 const std::wstring& value_data, |
132 bool overwrite); | 143 bool overwrite, |
| 144 RegWow64ViewOption reg_wow64_option); |
133 | 145 |
134 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type | 146 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type |
135 // at the key with specified path. | 147 // at the key with specified path. |
136 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 148 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
137 HKEY predefined_root, | 149 HKEY predefined_root, |
138 const std::wstring& key_path, | 150 const std::wstring& key_path, |
139 const std::wstring& value_name, | 151 const std::wstring& value_name, |
140 DWORD value_data, bool overwrite); | 152 DWORD value_data, bool overwrite, |
| 153 RegWow64ViewOption reg_wow64_option); |
141 | 154 |
142 // Create a SetRegValueWorkItem that sets a registry value with REG_QWORD type | 155 // Create a SetRegValueWorkItem that sets a registry value with REG_QWORD type |
143 // at the key with specified path. | 156 // at the key with specified path. |
144 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 157 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
145 HKEY predefined_root, | 158 HKEY predefined_root, |
146 const std::wstring& key_path, | 159 const std::wstring& key_path, |
147 const std::wstring& value_name, | 160 const std::wstring& value_name, |
148 int64 value_data, bool overwrite); | 161 int64 value_data, bool overwrite, |
| 162 RegWow64ViewOption reg_wow64_option); |
149 | 163 |
150 // Add a SelfRegWorkItem that registers or unregisters a DLL at the | 164 // Add a SelfRegWorkItem that registers or unregisters a DLL at the |
151 // specified path. | 165 // specified path. |
152 static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path, | 166 static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path, |
153 bool do_register, | 167 bool do_register, |
154 bool user_level_registration); | 168 bool user_level_registration); |
155 | 169 |
156 // Create an empty WorkItemList. A WorkItemList can recursively contains | 170 // Create an empty WorkItemList. A WorkItemList can recursively contains |
157 // a list of WorkItems. | 171 // a list of WorkItems. |
158 static WorkItemList* CreateWorkItemList(); | 172 static WorkItemList* CreateWorkItemList(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 WorkItem(); | 217 WorkItem(); |
204 | 218 |
205 // Specifies whether this work item my fail to complete and yet still | 219 // Specifies whether this work item my fail to complete and yet still |
206 // return true from Do(). | 220 // return true from Do(). |
207 bool ignore_failure_; | 221 bool ignore_failure_; |
208 | 222 |
209 std::string log_message_; | 223 std::string log_message_; |
210 }; | 224 }; |
211 | 225 |
212 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 226 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
OLD | NEW |