| 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 in the event of rollback the key's values and subkeys are restored but |
| 19 // the key and its subkeys take on their default security descriptors. |
| 17 class DeleteRegKeyWorkItem : public WorkItem { | 20 class DeleteRegKeyWorkItem : public WorkItem { |
| 18 public: | 21 public: |
| 19 virtual ~DeleteRegKeyWorkItem(); | 22 virtual ~DeleteRegKeyWorkItem(); |
| 20 | 23 |
| 21 virtual bool Do(); | 24 virtual bool Do(); |
| 22 | 25 |
| 23 virtual void Rollback(); | 26 virtual void Rollback(); |
| 24 | 27 |
| 25 private: | 28 private: |
| 29 class RegKeyBackup; |
| 26 friend class WorkItem; | 30 friend class WorkItem; |
| 27 | 31 |
| 28 DeleteRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); | 32 DeleteRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); |
| 29 | 33 |
| 30 // Root key from which we delete the key. The root key can only be | 34 // Root key from which we delete the key. The root key can only be |
| 31 // one of the predefined keys on Windows. | 35 // one of the predefined keys on Windows. |
| 32 HKEY predefined_root_; | 36 HKEY predefined_root_; |
| 33 | 37 |
| 34 // Path of the key to be deleted. | 38 // Path of the key to be deleted. |
| 35 std::wstring path_; | 39 std::wstring path_; |
| 36 | 40 |
| 37 // Path in the registry that the key is backed up to. | 41 // Backup of the deleted key. |
| 38 std::wstring backup_path_; | 42 scoped_ptr<RegKeyBackup> backup_; |
| 39 | 43 |
| 40 private: | |
| 41 DISALLOW_COPY_AND_ASSIGN(DeleteRegKeyWorkItem); | 44 DISALLOW_COPY_AND_ASSIGN(DeleteRegKeyWorkItem); |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 #endif // CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ | 47 #endif // CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ |
| OLD | NEW |