| 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_COPY_REG_KEY_WORK_ITEM_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_ |
| 6 #define CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_ | 6 #define CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "chrome/installer/util/registry_key_backup.h" | 13 #include "chrome/installer/util/registry_key_backup.h" |
| 14 #include "chrome/installer/util/work_item.h" | 14 #include "chrome/installer/util/work_item.h" |
| 15 | 15 |
| 16 // A WorkItem subclass that replaces the contents of one registry key with that | 16 // A WorkItem subclass that replaces the contents of one registry key with that |
| 17 // of another (i.e., the destination is erased prior to the copy). Be aware | 17 // of another (i.e., the destination is erased prior to the copy). Be aware |
| 18 // that in the event of rollback the destination key's values and subkeys are | 18 // that in the event of rollback the destination key's values and subkeys are |
| 19 // restored but the key and its subkeys take on their default security | 19 // restored but the key and its subkeys take on their default security |
| 20 // descriptors. | 20 // descriptors. |
| 21 class CopyRegKeyWorkItem : public WorkItem { | 21 class CopyRegKeyWorkItem : public WorkItem { |
| 22 public: | 22 public: |
| 23 virtual ~CopyRegKeyWorkItem(); | 23 virtual ~CopyRegKeyWorkItem(); |
| 24 virtual bool Do() OVERRIDE; | 24 virtual bool Do() OVERRIDE; |
| 25 virtual void Rollback() OVERRIDE; | 25 virtual void Rollback() OVERRIDE; |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 // Grant WorkItem access to the ctor (required by the existing WorkItem |
| 29 // design). |
| 28 friend class WorkItem; | 30 friend class WorkItem; |
| 29 | 31 |
| 30 // Neither |source_key_path| nor |dest_key_path| may be empty. | 32 // Neither |source_key_path| nor |dest_key_path| may be empty. |
| 31 // Only ALWAYS and IF_NOT_PRESENT are supported for |overwrite_option|. | 33 // Only ALWAYS and IF_NOT_PRESENT are supported for |overwrite_option|. |
| 32 CopyRegKeyWorkItem(HKEY predefined_key, | 34 CopyRegKeyWorkItem(HKEY predefined_key, |
| 33 const std::wstring& source_key_path, | 35 const std::wstring& source_key_path, |
| 34 const std::wstring& dest_key_path, | 36 const std::wstring& dest_key_path, |
| 35 CopyOverWriteOption overwrite_option); | 37 CopyOverWriteOption overwrite_option); |
| 36 | 38 |
| 37 // Root key in which we operate. The root key must be one of the predefined | 39 // Root key in which we operate. The root key must be one of the predefined |
| 38 // keys on Windows. | 40 // keys on Windows. |
| 39 HKEY predefined_root_; | 41 HKEY predefined_root_; |
| 40 | 42 |
| 41 // Path of the key to be copied. | 43 // Path of the key to be copied. |
| 42 std::wstring source_key_path_; | 44 std::wstring source_key_path_; |
| 43 | 45 |
| 44 // Path of the destination key. | 46 // Path of the destination key. |
| 45 std::wstring dest_key_path_; | 47 std::wstring dest_key_path_; |
| 46 | 48 |
| 49 // WorkItem::ALWAYS or WorkItem::IF_NOT_PRESENT. |
| 47 CopyOverWriteOption overwrite_option_; | 50 CopyOverWriteOption overwrite_option_; |
| 48 | 51 |
| 49 // Backup of the destination key. | 52 // Backup of the destination key. |
| 50 RegistryKeyBackup backup_; | 53 RegistryKeyBackup backup_; |
| 51 | 54 |
| 52 // Set to true after the destination is cleared for the copy. | 55 // Set to true after the destination is cleared for the copy. |
| 53 bool cleared_destination_; | 56 bool cleared_destination_; |
| 54 | 57 |
| 55 DISALLOW_COPY_AND_ASSIGN(CopyRegKeyWorkItem); | 58 DISALLOW_COPY_AND_ASSIGN(CopyRegKeyWorkItem); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 #endif // CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_ | 61 #endif // CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_ |
| OLD | NEW |