OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DELETE_REG_KEY_WORK_ITEM_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ |
6 #define CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ | 6 #define CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/scoped_ptr.h" | |
14 #include "chrome/installer/util/work_item.h" | 15 #include "chrome/installer/util/work_item.h" |
15 | 16 |
16 // A WorkItem subclass that deletes a registry key at the given path. | 17 // A WorkItem subclass that deletes a registry key at the given path. Be aware |
18 // that if failures are not ignored, an in-memory backup is made of the key and | |
19 // its values. In the event of rollback, the key's values and subkeys are | |
20 // restored, but the key and its subkeys take on their default security | |
21 // descriptors. | |
robertshield
2011/03/01 16:04:43
Could simplify the above comment to read:
"Be awa
grt (UTC plus 2)
2011/03/01 20:54:02
Done.
| |
17 class DeleteRegKeyWorkItem : public WorkItem { | 22 class DeleteRegKeyWorkItem : public WorkItem { |
18 public: | 23 public: |
19 virtual ~DeleteRegKeyWorkItem(); | 24 virtual ~DeleteRegKeyWorkItem(); |
20 | 25 |
21 virtual bool Do(); | 26 virtual bool Do(); |
22 | 27 |
23 virtual void Rollback(); | 28 virtual void Rollback(); |
24 | 29 |
25 private: | 30 private: |
31 class RegKeyBackup; | |
26 friend class WorkItem; | 32 friend class WorkItem; |
27 | 33 |
28 DeleteRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); | 34 DeleteRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); |
29 | 35 |
30 // Root key from which we delete the key. The root key can only be | 36 // Root key from which we delete the key. The root key can only be |
31 // one of the predefined keys on Windows. | 37 // one of the predefined keys on Windows. |
32 HKEY predefined_root_; | 38 HKEY predefined_root_; |
33 | 39 |
34 // Path of the key to be deleted. | 40 // Path of the key to be deleted. |
35 std::wstring path_; | 41 std::wstring path_; |
36 | 42 |
37 // Path in the registry that the key is backed up to. | 43 // Backup of the deleted key. |
38 std::wstring backup_path_; | 44 scoped_ptr<RegKeyBackup> backup_; |
39 | 45 |
40 private: | |
41 DISALLOW_COPY_AND_ASSIGN(DeleteRegKeyWorkItem); | 46 DISALLOW_COPY_AND_ASSIGN(DeleteRegKeyWorkItem); |
42 }; | 47 }; |
43 | 48 |
44 #endif // CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ | 49 #endif // CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ |
OLD | NEW |