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.
5 #ifndef CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__
6 #define CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__
13 #include "chrome/installer/util/work_item.h"
15 // A WorkItem subclass that sets a registry value with REG_SZ, REG_DWORD, or
16 // REG_QWORD type at the specified path. The value is only set if the target key
18 class SetRegValueWorkItem : public WorkItem {
20 virtual ~SetRegValueWorkItem();
24 virtual void Rollback();
27 friend class WorkItem;
30 // The status before Do is called.
32 // One possible outcome after Do(). A new value is created under the key.
34 // One possible outcome after Do(). The previous value under the key has
37 // One possible outcome after Do(). No change is applied, either
38 // because we are not allowed to overwrite the previous value, or due to
39 // some errors like the key does not exist.
41 // The status after Do and Rollback is called.
45 SetRegValueWorkItem(HKEY predefined_root,
46 const std::wstring& key_path,
47 const std::wstring& value_name,
48 const std::wstring& value_data,
51 SetRegValueWorkItem(HKEY predefined_root, const std::wstring& key_path,
52 const std::wstring& value_name, DWORD value_data,
55 SetRegValueWorkItem(HKEY predefined_root, const std::wstring& key_path,
56 const std::wstring& value_name, int64 value_data,
59 // Root key of the target key under which the value is set. The root key can
60 // only be one of the predefined keys on Windows.
61 HKEY predefined_root_;
63 // Path of the target key under which the value is set.
64 std::wstring key_path_;
66 // Name of the value to be set.
67 std::wstring value_name_;
69 // Whether to overwrite the existing value under the target key.
72 // Type of data to store
74 std::vector<uint8> value_;
76 std::vector<uint8> previous_value_;
78 SettingStatus status_;
81 #endif // CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__