| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Base class for managing an action of a sequence of actions to be carried | 5 // Base class for managing an action of a sequence of actions to be carried |
| 6 // out during install/update/uninstall. Supports rollback of actions if this | 6 // out during install/update/uninstall. Supports rollback of actions if this |
| 7 // process fails. | 7 // process fails. |
| 8 | 8 |
| 9 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 9 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
| 10 #define CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 10 #define CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 #include <windows.h> | 13 #include <windows.h> |
| 14 | 14 |
| 15 class CopyTreeWorkItem; | 15 class CopyTreeWorkItem; |
| 16 class CreateDirWorkItem; | 16 class CreateDirWorkItem; |
| 17 class CreateRegKeyWorkItem; | 17 class CreateRegKeyWorkItem; |
| 18 class DeleteTreeWorkItem; | 18 class DeleteTreeWorkItem; |
| 19 class DeleteRegValueWorkItem; | 19 class DeleteRegValueWorkItem; |
| 20 class MoveTreeWorkItem; |
| 20 class SetRegValueWorkItem; | 21 class SetRegValueWorkItem; |
| 21 class WorkItemList; | 22 class WorkItemList; |
| 22 | 23 |
| 23 // A base class that defines APIs to perform/rollback an action or a | 24 // A base class that defines APIs to perform/rollback an action or a |
| 24 // sequence of actions during install/update/uninstall. | 25 // sequence of actions during install/update/uninstall. |
| 25 class WorkItem { | 26 class WorkItem { |
| 26 public: | 27 public: |
| 27 // Possible states | 28 // Possible states |
| 28 typedef enum CopyOverWriteOption { | 29 typedef enum CopyOverWriteOption { |
| 29 ALWAYS, // Always overwrite regardless of what existed before. | 30 ALWAYS, // Always overwrite regardless of what existed before. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 58 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem( | 59 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem( |
| 59 HKEY predefined_root, std::wstring key_path, | 60 HKEY predefined_root, std::wstring key_path, |
| 60 std::wstring value_name, bool is_str_type); | 61 std::wstring value_name, bool is_str_type); |
| 61 | 62 |
| 62 // Create a DeleteTreeWorkItem that recursively deletes a file system | 63 // Create a DeleteTreeWorkItem that recursively deletes a file system |
| 63 // hierarchy at the given root path. A key file can be optionally specified | 64 // hierarchy at the given root path. A key file can be optionally specified |
| 64 // by key_path. | 65 // by key_path. |
| 65 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem(std::wstring root_path, | 66 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem(std::wstring root_path, |
| 66 std::wstring key_path); | 67 std::wstring key_path); |
| 67 | 68 |
| 69 // Create a MoveTreeWorkItem that recursively moves a file system hierarchy |
| 70 // from source path to destination path. |
| 71 static MoveTreeWorkItem* CreateMoveTreeWorkItem(std::wstring source_path, |
| 72 std::wstring dest_path, std::wstring temp_dir); |
| 73 |
| 68 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type | 74 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type |
| 69 // at the key with specified path. | 75 // at the key with specified path. |
| 70 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 76 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
| 71 HKEY predefined_root, std::wstring key_path, | 77 HKEY predefined_root, std::wstring key_path, |
| 72 std::wstring value_name, std::wstring value_data, bool overwrite); | 78 std::wstring value_name, std::wstring value_data, bool overwrite); |
| 73 | 79 |
| 74 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type | 80 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type |
| 75 // at the key with specified path. | 81 // at the key with specified path. |
| 76 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 82 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
| 77 HKEY predefined_root, std::wstring key_path, | 83 HKEY predefined_root, std::wstring key_path, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 99 | 105 |
| 100 // For diagnostics. | 106 // For diagnostics. |
| 101 virtual std::wstring Dump(); | 107 virtual std::wstring Dump(); |
| 102 | 108 |
| 103 protected: | 109 protected: |
| 104 WorkItem(); | 110 WorkItem(); |
| 105 }; | 111 }; |
| 106 | 112 |
| 107 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 113 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
| 108 | 114 |
| OLD | NEW |