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_SET_REG_VALUE_WORK_ITEM_H__ | 5 #ifndef CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ |
6 #define CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ | 6 #define CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 #include "base/callback.h" |
13 #include "chrome/installer/util/work_item.h" | 14 #include "chrome/installer/util/work_item.h" |
14 | 15 |
15 // A WorkItem subclass that sets a registry value with REG_SZ, REG_DWORD, or | 16 // 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 | 17 // REG_QWORD type at the specified path. The value is only set if the target key |
17 // exists. | 18 // exists. |
18 class SetRegValueWorkItem : public WorkItem { | 19 class SetRegValueWorkItem : public WorkItem { |
19 public: | 20 public: |
20 ~SetRegValueWorkItem() override; | 21 ~SetRegValueWorkItem() override; |
21 | 22 |
22 bool Do() override; | 23 bool Do() override; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 DWORD value_data, | 57 DWORD value_data, |
57 bool overwrite); | 58 bool overwrite); |
58 | 59 |
59 SetRegValueWorkItem(HKEY predefined_root, | 60 SetRegValueWorkItem(HKEY predefined_root, |
60 const std::wstring& key_path, | 61 const std::wstring& key_path, |
61 REGSAM wow64_access, | 62 REGSAM wow64_access, |
62 const std::wstring& value_name, | 63 const std::wstring& value_name, |
63 int64 value_data, | 64 int64 value_data, |
64 bool overwrite); | 65 bool overwrite); |
65 | 66 |
| 67 // Implies |overwrite_| and TYPE_SZ for now. |
| 68 SetRegValueWorkItem(HKEY predefined_root, |
| 69 const std::wstring& key_path, |
| 70 REGSAM wow64_access, |
| 71 const std::wstring& value_name, |
| 72 const GetValueFromExistingCallback& get_value_callback); |
| 73 |
66 // Root key of the target key under which the value is set. The root key can | 74 // Root key of the target key under which the value is set. The root key can |
67 // only be one of the predefined keys on Windows. | 75 // only be one of the predefined keys on Windows. |
68 HKEY predefined_root_; | 76 HKEY predefined_root_; |
69 | 77 |
70 // Path of the target key under which the value is set. | 78 // Path of the target key under which the value is set. |
71 std::wstring key_path_; | 79 std::wstring key_path_; |
72 | 80 |
73 // Name of the value to be set. | 81 // Name of the value to be set. |
74 std::wstring value_name_; | 82 std::wstring value_name_; |
75 | 83 |
| 84 // If this is set, it will be used to get the desired value to be set based on |
| 85 // the existing value in the registry. |
| 86 const GetValueFromExistingCallback get_value_callback_; |
| 87 |
76 // Whether to overwrite the existing value under the target key. | 88 // Whether to overwrite the existing value under the target key. |
77 bool overwrite_; | 89 bool overwrite_; |
78 | 90 |
79 // Whether to force 32-bit or 64-bit view of the target key. | 91 // Whether to force 32-bit or 64-bit view of the target key. |
80 REGSAM wow64_access_; | 92 REGSAM wow64_access_; |
81 | 93 |
82 // Type of data to store | 94 // Type of data to store |
83 DWORD type_; | 95 DWORD type_; |
84 std::vector<uint8> value_; | 96 std::vector<uint8> value_; |
85 DWORD previous_type_; | 97 DWORD previous_type_; |
86 std::vector<uint8> previous_value_; | 98 std::vector<uint8> previous_value_; |
87 | 99 |
88 SettingStatus status_; | 100 SettingStatus status_; |
89 }; | 101 }; |
90 | 102 |
91 #endif // CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ | 103 #endif // CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ |
OLD | NEW |