summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/copy_reg_key_work_item.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer/util/copy_reg_key_work_item.h')
-rw-r--r--chrome/installer/util/copy_reg_key_work_item.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/chrome/installer/util/copy_reg_key_work_item.h b/chrome/installer/util/copy_reg_key_work_item.h
new file mode 100644
index 0000000..b1d4631
--- /dev/null
+++ b/chrome/installer/util/copy_reg_key_work_item.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_
+#define CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/installer/util/registry_key_backup.h"
+#include "chrome/installer/util/work_item.h"
+
+// A WorkItem subclass that replaces the contents of one registry key with that
+// of another (i.e., the destination is erased prior to the copy). Be aware
+// that in the event of rollback the destination key's values and subkeys are
+// restored but the key and its subkeys take on their default security
+// descriptors.
+class CopyRegKeyWorkItem : public WorkItem {
+ public:
+ virtual ~CopyRegKeyWorkItem();
+ virtual bool Do() OVERRIDE;
+ virtual void Rollback() OVERRIDE;
+
+ private:
+ friend class WorkItem;
+
+ // Neither |source_key_path| nor |dest_key_path| may be empty.
+ CopyRegKeyWorkItem(HKEY predefined_key,
+ const std::wstring& source_key_path,
+ const std::wstring& dest_key_path);
+
+ // Root key in which we operate. The root key must be one of the predefined
+ // keys on Windows.
+ HKEY predefined_root_;
+
+ // Path of the key to be copied.
+ std::wstring source_key_path_;
+
+ // Path of the destination key.
+ std::wstring dest_key_path_;
+
+ // Backup of the destination key.
+ RegistryKeyBackup backup_;
+
+ DISALLOW_COPY_AND_ASSIGN(CopyRegKeyWorkItem);
+};
+
+#endif // CHROME_INSTALLER_UTIL_COPY_REG_KEY_WORK_ITEM_H_