Enable MSVC warning for unused locals.
[chromium-blink-merge.git] / chrome / installer / util / create_reg_key_work_item.h
blob455cb4bc5578ab5b419533cec4e45bed0ed6a8a8
1 // Copyright (c) 2009 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.
5 #ifndef CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__
6 #define CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__
8 #include <windows.h>
10 #include <string>
11 #include <vector>
13 #include "chrome/installer/util/work_item.h"
15 // A WorkItem subclass that creates a registry key at the given path.
16 // It also creates all necessary intermediate keys if they do not exist.
17 class CreateRegKeyWorkItem : public WorkItem {
18 public:
19 virtual ~CreateRegKeyWorkItem();
21 virtual bool Do();
23 virtual void Rollback();
25 private:
26 friend class WorkItem;
28 CreateRegKeyWorkItem(HKEY predefined_root,
29 const std::wstring& path,
30 REGSAM wow64_access);
32 // Initialize key_list_ by adding all paths of keys from predefined_root_
33 // to path_. Returns true if key_list_ is non empty.
34 bool InitKeyList();
36 // Root key under which we create the new key. The root key can only be
37 // one of the predefined keys on Windows.
38 HKEY predefined_root_;
40 // Path of the key to be created.
41 std::wstring path_;
43 // Whether to force 32-bit or 64-bit view of the target key.
44 REGSAM wow64_access_;
46 // List of paths to all keys that need to be created from predefined_root_
47 // to path_.
48 std::vector<std::wstring> key_list_;
50 // Whether any key has been created.
51 bool key_created_;
54 #endif // CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__