| 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 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H__ | 5 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ |
| 6 #define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H__ | 6 #define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "chrome/installer/util/work_item.h" | 13 #include "chrome/installer/util/work_item.h" |
| 14 | 14 |
| 15 // A WorkItem subclass that recursively contains a list of WorkItems. Thus it | 15 // A WorkItem subclass that recursively contains a list of WorkItems. Thus it |
| 16 // provides functionalities to carry out or roll back the sequence of actions | 16 // provides functionalities to carry out or roll back the sequence of actions |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 // Rollback the WorkItems in the reverse order as they are executed. | 27 // Rollback the WorkItems in the reverse order as they are executed. |
| 28 virtual void Rollback(); | 28 virtual void Rollback(); |
| 29 | 29 |
| 30 // Add a WorkItem to the list. Return true if the WorkItem is successfully | 30 // Add a WorkItem to the list. Return true if the WorkItem is successfully |
| 31 // added. Return false otherwise. | 31 // added. Return false otherwise. |
| 32 // A WorkItem can only be added to the list before the list's DO() is called. | 32 // A WorkItem can only be added to the list before the list's DO() is called. |
| 33 // Once a WorkItem is added to the list. The list owns the WorkItem. | 33 // Once a WorkItem is added to the list. The list owns the WorkItem. |
| 34 bool AddWorkItem(WorkItem* work_item); | 34 bool AddWorkItem(WorkItem* work_item); |
| 35 | 35 |
| 36 // Add a CopyTreeWorkItem to the list of work items. | 36 // Add a CopyTreeWorkItem to the list of work items. |
| 37 bool AddCopyTreeWorkItem(std::wstring source_path, std::wstring dest_path, | 37 bool AddCopyTreeWorkItem(const std::wstring& source_path, |
| 38 std::wstring temp_dir, | 38 const std::wstring& dest_path, |
| 39 const std::wstring& temp_dir, |
| 39 CopyOverWriteOption overwrite_option, | 40 CopyOverWriteOption overwrite_option, |
| 40 std::wstring alternative_path = L""); | 41 const std::wstring& alternative_path = L""); |
| 41 | 42 |
| 42 // Add a CreateDirWorkItem that creates a directory at the given path. | 43 // Add a CreateDirWorkItem that creates a directory at the given path. |
| 43 bool AddCreateDirWorkItem(std::wstring path); | 44 bool AddCreateDirWorkItem(const std::wstring& path); |
| 44 | 45 |
| 45 // Add a CreateRegKeyWorkItem that creates a registry key at the given | 46 // Add a CreateRegKeyWorkItem that creates a registry key at the given |
| 46 // path. | 47 // path. |
| 47 bool AddCreateRegKeyWorkItem(HKEY predefined_root, std::wstring path); | 48 bool AddCreateRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); |
| 48 | 49 |
| 49 // Add a DeleteRegValueWorkItem that deletes registry value of type REG_SZ | 50 // Add a DeleteRegValueWorkItem that deletes registry value of type REG_SZ |
| 50 // or REG_DWORD. | 51 // or REG_DWORD. |
| 51 bool AddDeleteRegValueWorkItem(HKEY predefined_root, std::wstring key_path, | 52 bool AddDeleteRegValueWorkItem(HKEY predefined_root, |
| 52 std::wstring value_name, bool is_str_type); | 53 const std::wstring& key_path, |
| 54 const std::wstring& value_name, |
| 55 bool is_str_type); |
| 53 | 56 |
| 54 // Add a DeleteTreeWorkItem that recursively deletes a file system | 57 // Add a DeleteTreeWorkItem that recursively deletes a file system |
| 55 // hierarchy at the given root path. A key file can be optionally specified | 58 // hierarchy at the given root path. A key file can be optionally specified |
| 56 // by key_path. | 59 // by key_path. |
| 57 bool AddDeleteTreeWorkItem(std::wstring root_path, std::wstring key_path); | 60 bool AddDeleteTreeWorkItem(const std::wstring& root_path, |
| 61 const std::wstring& key_path); |
| 58 | 62 |
| 59 // Add a MoveTreeWorkItem to the list of work items. | 63 // Add a MoveTreeWorkItem to the list of work items. |
| 60 bool AddMoveTreeWorkItem(std::wstring source_path, std::wstring dest_path, | 64 bool AddMoveTreeWorkItem(const std::wstring& source_path, |
| 61 std::wstring temp_dir); | 65 const std::wstring& dest_path, |
| 66 const std::wstring& temp_dir); |
| 62 | 67 |
| 63 // Add a SetRegValueWorkItem that sets a registry value with REG_SZ type | 68 // Add a SetRegValueWorkItem that sets a registry value with REG_SZ type |
| 64 // at the key with specified path. | 69 // at the key with specified path. |
| 65 bool AddSetRegValueWorkItem(HKEY predefined_root, std::wstring key_path, | 70 bool AddSetRegValueWorkItem(HKEY predefined_root, |
| 66 std::wstring value_name, std::wstring value_data, | 71 const std::wstring& key_path, |
| 72 const std::wstring& value_name, |
| 73 const std::wstring& value_data, |
| 67 bool overwrite); | 74 bool overwrite); |
| 68 | 75 |
| 69 // Add a SetRegValueWorkItem that sets a registry value with REG_DWORD type | 76 // Add a SetRegValueWorkItem that sets a registry value with REG_DWORD type |
| 70 // at the key with specified path. | 77 // at the key with specified path. |
| 71 bool AddSetRegValueWorkItem(HKEY predefined_root, std::wstring key_path, | 78 bool AddSetRegValueWorkItem(HKEY predefined_root, |
| 72 std::wstring value_name, DWORD value_data, | 79 const std::wstring& key_path, |
| 80 const std::wstring& value_name, |
| 81 DWORD value_data, |
| 73 bool overwrite); | 82 bool overwrite); |
| 74 | 83 |
| 75 // Add a SelfRegWorkItem that registers or unregisters a DLL at the | 84 // Add a SelfRegWorkItem that registers or unregisters a DLL at the |
| 76 // specified path. | 85 // specified path. |
| 77 bool AddSelfRegWorkItem(const std::wstring& dll_path, bool do_register); | 86 bool AddSelfRegWorkItem(const std::wstring& dll_path, bool do_register); |
| 78 | 87 |
| 79 private: | 88 private: |
| 80 friend class WorkItem; | 89 friend class WorkItem; |
| 81 | 90 |
| 82 typedef std::list<WorkItem*> WorkItems; | 91 typedef std::list<WorkItem*> WorkItems; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 96 ListStatus status_; | 105 ListStatus status_; |
| 97 | 106 |
| 98 // The list of WorkItems, in the order of them being added. | 107 // The list of WorkItems, in the order of them being added. |
| 99 WorkItems list_; | 108 WorkItems list_; |
| 100 | 109 |
| 101 // The list of executed WorkItems, in the reverse order of them being | 110 // The list of executed WorkItems, in the reverse order of them being |
| 102 // executed. | 111 // executed. |
| 103 WorkItems executed_list_; | 112 WorkItems executed_list_; |
| 104 }; | 113 }; |
| 105 | 114 |
| 106 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H__ | 115 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ |
| OLD | NEW |