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 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Implies |overwrite_| and TYPE_SZ for now. | 43 // Implies |overwrite_| and TYPE_SZ for now. |
44 SetRegValueWorkItem(HKEY predefined_root, | 44 SetRegValueWorkItem(HKEY predefined_root, |
45 const std::wstring& key_path, | 45 const std::wstring& key_path, |
46 REGSAM wow64_access, | 46 REGSAM wow64_access, |
47 const std::wstring& value_name, | 47 const std::wstring& value_name, |
48 const GetValueFromExistingCallback& get_value_callback); | 48 const GetValueFromExistingCallback& get_value_callback); |
49 | 49 |
50 ~SetRegValueWorkItem() override; | 50 ~SetRegValueWorkItem() override; |
51 | 51 |
52 bool Do() override; | |
53 | |
54 void Rollback() override; | |
55 | |
56 private: | 52 private: |
57 enum SettingStatus { | 53 enum SettingStatus { |
58 // The status before Do is called. | 54 // The status before Do is called. |
59 SET_VALUE, | 55 SET_VALUE, |
60 // One possible outcome after Do(). A new value is created under the key. | 56 // One possible outcome after Do(). A new value is created under the key. |
61 NEW_VALUE_CREATED, | 57 NEW_VALUE_CREATED, |
62 // One possible outcome after Do(). The previous value under the key has | 58 // One possible outcome after Do(). The previous value under the key has |
63 // been overwritten. | 59 // been overwritten. |
64 VALUE_OVERWRITTEN, | 60 VALUE_OVERWRITTEN, |
65 // One possible outcome after Do(). No change is applied, either | 61 // One possible outcome after Do(). No change is applied, either |
66 // because we are not allowed to overwrite the previous value, or due to | 62 // because we are not allowed to overwrite the previous value, or due to |
67 // some errors like the key does not exist. | 63 // some errors like the key does not exist. |
68 VALUE_UNCHANGED, | 64 VALUE_UNCHANGED, |
69 // The status after Do and Rollback is called. | 65 // The status after Do and Rollback is called. |
70 VALUE_ROLL_BACK | 66 VALUE_ROLL_BACK |
71 }; | 67 }; |
72 | 68 |
| 69 // WorkItem: |
| 70 bool DoImpl() override; |
| 71 void RollbackImpl() override; |
| 72 |
73 // Root key of the target key under which the value is set. The root key can | 73 // Root key of the target key under which the value is set. The root key can |
74 // only be one of the predefined keys on Windows. | 74 // only be one of the predefined keys on Windows. |
75 HKEY predefined_root_; | 75 HKEY predefined_root_; |
76 | 76 |
77 // Path of the target key under which the value is set. | 77 // Path of the target key under which the value is set. |
78 std::wstring key_path_; | 78 std::wstring key_path_; |
79 | 79 |
80 // Name of the value to be set. | 80 // Name of the value to be set. |
81 std::wstring value_name_; | 81 std::wstring value_name_; |
82 | 82 |
(...skipping 10 matching lines...) Expand all Loading... |
93 // Type of data to store | 93 // Type of data to store |
94 DWORD type_; | 94 DWORD type_; |
95 std::vector<uint8_t> value_; | 95 std::vector<uint8_t> value_; |
96 DWORD previous_type_; | 96 DWORD previous_type_; |
97 std::vector<uint8_t> previous_value_; | 97 std::vector<uint8_t> previous_value_; |
98 | 98 |
99 SettingStatus status_; | 99 SettingStatus status_; |
100 }; | 100 }; |
101 | 101 |
102 #endif // CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ | 102 #endif // CHROME_INSTALLER_UTIL_SET_REG_VALUE_WORK_ITEM_H__ |
OLD | NEW |