| 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_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 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "chrome/installer/util/work_item.h" | 16 #include "chrome/installer/util/work_item.h" |
| 17 | 17 |
| 18 namespace base { |
| 18 class FilePath; | 19 class FilePath; |
| 20 } |
| 19 | 21 |
| 20 // A WorkItem subclass that recursively contains a list of WorkItems. Thus it | 22 // A WorkItem subclass that recursively contains a list of WorkItems. Thus it |
| 21 // provides functionalities to carry out or roll back the sequence of actions | 23 // provides functionalities to carry out or roll back the sequence of actions |
| 22 // defined by the list of WorkItems it contains. | 24 // defined by the list of WorkItems it contains. |
| 23 // The WorkItems are executed in the same order as they are added to the list. | 25 // The WorkItems are executed in the same order as they are added to the list. |
| 24 class WorkItemList : public WorkItem { | 26 class WorkItemList : public WorkItem { |
| 25 public: | 27 public: |
| 26 virtual ~WorkItemList(); | 28 virtual ~WorkItemList(); |
| 27 | 29 |
| 28 // Execute the WorkItems in the same order as they are added to the list. | 30 // Execute the WorkItems in the same order as they are added to the list. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 51 // See the NOTE in the documentation for the CopyTreeWorkItem class for | 53 // See the NOTE in the documentation for the CopyTreeWorkItem class for |
| 52 // special considerations regarding |temp_dir|. | 54 // special considerations regarding |temp_dir|. |
| 53 virtual WorkItem* AddCopyTreeWorkItem( | 55 virtual WorkItem* AddCopyTreeWorkItem( |
| 54 const std::wstring& source_path, | 56 const std::wstring& source_path, |
| 55 const std::wstring& dest_path, | 57 const std::wstring& dest_path, |
| 56 const std::wstring& temp_dir, | 58 const std::wstring& temp_dir, |
| 57 CopyOverWriteOption overwrite_option, | 59 CopyOverWriteOption overwrite_option, |
| 58 const std::wstring& alternative_path = L""); | 60 const std::wstring& alternative_path = L""); |
| 59 | 61 |
| 60 // Add a CreateDirWorkItem that creates a directory at the given path. | 62 // Add a CreateDirWorkItem that creates a directory at the given path. |
| 61 virtual WorkItem* AddCreateDirWorkItem(const FilePath& path); | 63 virtual WorkItem* AddCreateDirWorkItem(const base::FilePath& path); |
| 62 | 64 |
| 63 // Add a CreateRegKeyWorkItem that creates a registry key at the given | 65 // Add a CreateRegKeyWorkItem that creates a registry key at the given |
| 64 // path. | 66 // path. |
| 65 virtual WorkItem* AddCreateRegKeyWorkItem(HKEY predefined_root, | 67 virtual WorkItem* AddCreateRegKeyWorkItem(HKEY predefined_root, |
| 66 const std::wstring& path); | 68 const std::wstring& path); |
| 67 | 69 |
| 68 // Add a DeleteRegKeyWorkItem that deletes a registry key from the given | 70 // Add a DeleteRegKeyWorkItem that deletes a registry key from the given |
| 69 // path. | 71 // path. |
| 70 virtual WorkItem* AddDeleteRegKeyWorkItem(HKEY predefined_root, | 72 virtual WorkItem* AddDeleteRegKeyWorkItem(HKEY predefined_root, |
| 71 const std::wstring& path); | 73 const std::wstring& path); |
| 72 | 74 |
| 73 // Add a DeleteRegValueWorkItem that deletes registry value of type REG_SZ | 75 // Add a DeleteRegValueWorkItem that deletes registry value of type REG_SZ |
| 74 // or REG_DWORD. | 76 // or REG_DWORD. |
| 75 virtual WorkItem* AddDeleteRegValueWorkItem(HKEY predefined_root, | 77 virtual WorkItem* AddDeleteRegValueWorkItem(HKEY predefined_root, |
| 76 const std::wstring& key_path, | 78 const std::wstring& key_path, |
| 77 const std::wstring& value_name); | 79 const std::wstring& value_name); |
| 78 | 80 |
| 79 // Add a DeleteTreeWorkItem that recursively deletes a file system | 81 // Add a DeleteTreeWorkItem that recursively deletes a file system |
| 80 // hierarchy at the given root path. A key file can be optionally specified | 82 // hierarchy at the given root path. A key file can be optionally specified |
| 81 // by key_path. | 83 // by key_path. |
| 82 virtual WorkItem* AddDeleteTreeWorkItem( | 84 virtual WorkItem* AddDeleteTreeWorkItem( |
| 83 const FilePath& root_path, | 85 const base::FilePath& root_path, |
| 84 const FilePath& temp_path, | 86 const base::FilePath& temp_path, |
| 85 const std::vector<FilePath>& key_paths); | 87 const std::vector<base::FilePath>& key_paths); |
| 86 | 88 |
| 87 // Same as above but without support for key files. | 89 // Same as above but without support for key files. |
| 88 virtual WorkItem* AddDeleteTreeWorkItem(const FilePath& root_path, | 90 virtual WorkItem* AddDeleteTreeWorkItem(const base::FilePath& root_path, |
| 89 const FilePath& temp_path); | 91 const base::FilePath& temp_path); |
| 90 | 92 |
| 91 // Add a MoveTreeWorkItem to the list of work items. | 93 // Add a MoveTreeWorkItem to the list of work items. |
| 92 virtual WorkItem* AddMoveTreeWorkItem(const std::wstring& source_path, | 94 virtual WorkItem* AddMoveTreeWorkItem(const std::wstring& source_path, |
| 93 const std::wstring& dest_path, | 95 const std::wstring& dest_path, |
| 94 const std::wstring& temp_dir, | 96 const std::wstring& temp_dir, |
| 95 MoveTreeOption duplicate_option); | 97 MoveTreeOption duplicate_option); |
| 96 | 98 |
| 97 // Add a SetRegValueWorkItem that sets a registry value with REG_SZ type | 99 // Add a SetRegValueWorkItem that sets a registry value with REG_SZ type |
| 98 // at the key with specified path. | 100 // at the key with specified path. |
| 99 virtual WorkItem* AddSetRegValueWorkItem(HKEY predefined_root, | 101 virtual WorkItem* AddSetRegValueWorkItem(HKEY predefined_root, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Execute the WorkItems in the same order as they are added to the list. | 165 // Execute the WorkItems in the same order as they are added to the list. |
| 164 // If a WorkItem fails, the function will return failure but all other | 166 // If a WorkItem fails, the function will return failure but all other |
| 165 // WorkItems will still be executed. | 167 // WorkItems will still be executed. |
| 166 virtual bool Do(); | 168 virtual bool Do(); |
| 167 | 169 |
| 168 // Just does a NOTREACHED. | 170 // Just does a NOTREACHED. |
| 169 virtual void Rollback(); | 171 virtual void Rollback(); |
| 170 }; | 172 }; |
| 171 | 173 |
| 172 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ | 174 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ |
| OLD | NEW |