| 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 #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/memory/scoped_ptr.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "chrome/installer/util/registry_key_backup.h" |
| 15 #include "chrome/installer/util/work_item.h" | 16 #include "chrome/installer/util/work_item.h" |
| 16 | 17 |
| 18 class RegistryKeyBackup; |
| 19 |
| 17 // A WorkItem subclass that deletes a registry key at the given path. Be aware | 20 // 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 | 21 // 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. | 22 // the key and its subkeys take on their default security descriptors. |
| 20 class DeleteRegKeyWorkItem : public WorkItem { | 23 class DeleteRegKeyWorkItem : public WorkItem { |
| 21 public: | 24 public: |
| 22 virtual ~DeleteRegKeyWorkItem(); | 25 virtual ~DeleteRegKeyWorkItem(); |
| 23 | 26 |
| 24 virtual bool Do(); | 27 virtual bool Do() OVERRIDE; |
| 25 | 28 |
| 26 virtual void Rollback(); | 29 virtual void Rollback() OVERRIDE; |
| 27 | 30 |
| 28 private: | 31 private: |
| 29 class RegKeyBackup; | |
| 30 friend class WorkItem; | 32 friend class WorkItem; |
| 31 | 33 |
| 32 DeleteRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); | 34 DeleteRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); |
| 33 | 35 |
| 34 // 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 |
| 35 // one of the predefined keys on Windows. | 37 // one of the predefined keys on Windows. |
| 36 HKEY predefined_root_; | 38 HKEY predefined_root_; |
| 37 | 39 |
| 38 // Path of the key to be deleted. | 40 // Path of the key to be deleted. |
| 39 std::wstring path_; | 41 std::wstring path_; |
| 40 | 42 |
| 41 // Backup of the deleted key. | 43 // Backup of the deleted key. |
| 42 scoped_ptr<RegKeyBackup> backup_; | 44 RegistryKeyBackup backup_; |
| 43 | 45 |
| 44 DISALLOW_COPY_AND_ASSIGN(DeleteRegKeyWorkItem); | 46 DISALLOW_COPY_AND_ASSIGN(DeleteRegKeyWorkItem); |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 #endif // CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ | 49 #endif // CHROME_INSTALLER_UTIL_DELETE_REG_KEY_WORK_ITEM_H_ |
| OLD | NEW |