| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 virtual ~WorkItem(); | 38 virtual ~WorkItem(); |
| 39 | 39 |
| 40 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy | 40 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy |
| 41 // from source path to destination path. | 41 // from source path to destination path. |
| 42 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always | 42 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always |
| 43 // overwrites files. | 43 // overwrites files. |
| 44 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an | 44 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an |
| 45 // alternate name specified by alternative_path. | 45 // alternate name specified by alternative_path. |
| 46 static CopyTreeWorkItem* CreateCopyTreeWorkItem(std::wstring source_path, | 46 static CopyTreeWorkItem* CreateCopyTreeWorkItem( |
| 47 std::wstring dest_path, std::wstring temp_dir, | 47 const std::wstring& source_path, |
| 48 const std::wstring& dest_path, |
| 49 const std::wstring& temp_dir, |
| 48 CopyOverWriteOption overwrite_option, | 50 CopyOverWriteOption overwrite_option, |
| 49 std::wstring alternative_path = L""); | 51 const std::wstring& alternative_path = L""); |
| 50 | 52 |
| 51 // Create a CreateDirWorkItem that creates a directory at the given path. | 53 // Create a CreateDirWorkItem that creates a directory at the given path. |
| 52 static CreateDirWorkItem* CreateCreateDirWorkItem(std::wstring path); | 54 static CreateDirWorkItem* CreateCreateDirWorkItem(const std::wstring& path); |
| 53 | 55 |
| 54 // Create a CreateRegKeyWorkItem that creates a registry key at the given | 56 // Create a CreateRegKeyWorkItem that creates a registry key at the given |
| 55 // path. | 57 // path. |
| 56 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem( | 58 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem( |
| 57 HKEY predefined_root, std::wstring path); | 59 HKEY predefined_root, const std::wstring& path); |
| 58 | 60 |
| 59 // Create a DeleteRegValueWorkItem that deletes a registry value | 61 // Create a DeleteRegValueWorkItem that deletes a registry value |
| 60 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem( | 62 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem( |
| 61 HKEY predefined_root, std::wstring key_path, | 63 HKEY predefined_root, |
| 62 std::wstring value_name, bool is_str_type); | 64 const std::wstring& key_path, |
| 65 const std::wstring& value_name, |
| 66 bool is_str_type); |
| 63 | 67 |
| 64 // Create a DeleteTreeWorkItem that recursively deletes a file system | 68 // Create a DeleteTreeWorkItem that recursively deletes a file system |
| 65 // hierarchy at the given root path. A key file can be optionally specified | 69 // hierarchy at the given root path. A key file can be optionally specified |
| 66 // by key_path. | 70 // by key_path. |
| 67 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem(std::wstring root_path, | 71 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem( |
| 68 std::wstring key_path); | 72 const std::wstring& root_path, const std::wstring& key_path); |
| 69 | 73 |
| 70 // Create a MoveTreeWorkItem that recursively moves a file system hierarchy | 74 // Create a MoveTreeWorkItem that recursively moves a file system hierarchy |
| 71 // from source path to destination path. | 75 // from source path to destination path. |
| 72 static MoveTreeWorkItem* CreateMoveTreeWorkItem(std::wstring source_path, | 76 static MoveTreeWorkItem* CreateMoveTreeWorkItem( |
| 73 std::wstring dest_path, std::wstring temp_dir); | 77 const std::wstring& source_path, |
| 78 const std::wstring& dest_path, |
| 79 const std::wstring& temp_dir); |
| 74 | 80 |
| 75 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type | 81 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type |
| 76 // at the key with specified path. | 82 // at the key with specified path. |
| 77 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 83 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
| 78 HKEY predefined_root, std::wstring key_path, | 84 HKEY predefined_root, |
| 79 std::wstring value_name, std::wstring value_data, bool overwrite); | 85 const std::wstring& key_path, |
| 86 const std::wstring& value_name, |
| 87 const std::wstring& value_data, |
| 88 bool overwrite); |
| 80 | 89 |
| 81 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type | 90 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type |
| 82 // at the key with specified path. | 91 // at the key with specified path. |
| 83 static SetRegValueWorkItem* CreateSetRegValueWorkItem( | 92 static SetRegValueWorkItem* CreateSetRegValueWorkItem( |
| 84 HKEY predefined_root, std::wstring key_path, | 93 HKEY predefined_root, |
| 85 std::wstring value_name, DWORD value_data, bool overwrite); | 94 const std::wstring& key_path, |
| 95 const std::wstring& value_name, |
| 96 DWORD value_data, bool overwrite); |
| 86 | 97 |
| 87 // Add a SelfRegWorkItem that registers or unregisters a DLL at the | 98 // Add a SelfRegWorkItem that registers or unregisters a DLL at the |
| 88 // specified path. | 99 // specified path. |
| 89 static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path, | 100 static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path, |
| 90 bool do_register); | 101 bool do_register); |
| 91 | 102 |
| 92 // Create an empty WorkItemList. A WorkItemList can recursively contains | 103 // Create an empty WorkItemList. A WorkItemList can recursively contains |
| 93 // a list of WorkItems. | 104 // a list of WorkItems. |
| 94 static WorkItemList* CreateWorkItemList(); | 105 static WorkItemList* CreateWorkItemList(); |
| 95 | 106 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 110 virtual bool IsTransactional() { return false; } | 121 virtual bool IsTransactional() { return false; } |
| 111 | 122 |
| 112 // For diagnostics. | 123 // For diagnostics. |
| 113 virtual std::wstring Dump(); | 124 virtual std::wstring Dump(); |
| 114 | 125 |
| 115 protected: | 126 protected: |
| 116 WorkItem(); | 127 WorkItem(); |
| 117 }; | 128 }; |
| 118 | 129 |
| 119 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 130 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
| OLD | NEW |