Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/installer/util/registry_key_backup.h

Issue 7890069: Added CopyRegKeyWorkItem in support of IE low rights policy fixes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: sync'd to ToT again Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_INSTALLER_UTIL_REGISTRY_KEY_BACKUP_H_
6 #define CHROME_INSTALLER_UTIL_REGISTRY_KEY_BACKUP_H_
7 #pragma once
8
9 #include <windows.h>
10
11 #include <string>
12
13 #include "base/basictypes.h"
14 #include "base/memory/scoped_ptr.h"
15
16 namespace base {
17 namespace win {
18 class RegKey;
19 } // namespace win
20 } // namespace base
21
22 // A container for a registry key, its values, and its subkeys. We don't use
23 // more obvious methods for various reasons:
24 // - RegCopyTree isn't supported pre-Vista, so we'd have to do something
25 // different for XP anyway.
26 // - SHCopyKey can't copy subkeys into a volatile destination, so we'd have to
27 // worry about polluting the registry.
28 // We don't persist security attributes since we only delete keys that we own,
29 // and we don't set custom attributes on them anyway.
30 class RegistryKeyBackup {
31 public:
32 RegistryKeyBackup();
33 ~RegistryKeyBackup();
34
35 // Recursively reads |key_path| into this instance. Backing up a non-existent
36 // key is valid. Returns true if the backup was successful; false otherwise,
37 // in which case the state of this instance is not modified.
38 bool Initialize(HKEY root, const wchar_t* key_path);
39
40 // Writes the contents of this instance into |key|. The contents of
41 // |key_path| are not modified If this instance is uninitialized or was
42 // initialized from a non-existent key.
43 bool WriteTo(HKEY root, const wchar_t* key_path) const;
44
45 void swap(RegistryKeyBackup& other) {
46 key_data_.swap(other.key_data_);
47 }
48
49 private:
50 class KeyData;
51
52 scoped_ptr<KeyData> key_data_;
53
54 DISALLOW_COPY_AND_ASSIGN(RegistryKeyBackup);
55 };
56
57 #endif // CHROME_INSTALLER_UTIL_REGISTRY_KEY_BACKUP_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_reg_key_work_item_unittest.cc ('k') | chrome/installer/util/registry_key_backup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698