Chromium Code Reviews| 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 // 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 #pragma once | 11 #pragma once |
| 12 | 12 |
| 13 #include <windows.h> | 13 #include <windows.h> |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
| 19 // TODO: forward declare FilePath once default argument is removed below. | |
| 20 #include "base/file_path.h" | |
| 19 | 21 |
| 20 class CopyTreeWorkItem; | 22 class CopyTreeWorkItem; |
| 21 class CreateDirWorkItem; | 23 class CreateDirWorkItem; |
| 22 class CreateRegKeyWorkItem; | 24 class CreateRegKeyWorkItem; |
| 23 class DeleteTreeWorkItem; | 25 class DeleteTreeWorkItem; |
| 24 class DeleteRegKeyWorkItem; | 26 class DeleteRegKeyWorkItem; |
| 25 class DeleteRegValueWorkItem; | 27 class DeleteRegValueWorkItem; |
| 26 class FilePath; | |
| 27 class MoveTreeWorkItem; | 28 class MoveTreeWorkItem; |
| 28 class SelfRegWorkItem; | 29 class SelfRegWorkItem; |
| 29 class SetRegValueWorkItem; | 30 class SetRegValueWorkItem; |
| 30 class WorkItemList; | 31 class WorkItemList; |
| 31 | 32 |
| 32 // A base class that defines APIs to perform/rollback an action or a | 33 // A base class that defines APIs to perform/rollback an action or a |
| 33 // sequence of actions during install/update/uninstall. | 34 // sequence of actions during install/update/uninstall. |
| 34 class WorkItem { | 35 class WorkItem { |
| 35 public: | 36 public: |
| 36 // Possible states | 37 // Possible states |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 52 | 53 |
| 53 virtual ~WorkItem(); | 54 virtual ~WorkItem(); |
| 54 | 55 |
| 55 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy | 56 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy |
| 56 // from source path to destination path. | 57 // from source path to destination path. |
| 57 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always | 58 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always |
| 58 // overwrites files. | 59 // overwrites files. |
| 59 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an | 60 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an |
| 60 // alternate name specified by alternative_path. | 61 // alternate name specified by alternative_path. |
| 61 static CopyTreeWorkItem* CreateCopyTreeWorkItem( | 62 static CopyTreeWorkItem* CreateCopyTreeWorkItem( |
| 62 const std::wstring& source_path, | 63 const FilePath& source_path, |
| 63 const std::wstring& dest_path, | 64 const FilePath& dest_path, |
| 64 const std::wstring& temp_dir, | 65 const FilePath& temp_dir, |
| 65 CopyOverWriteOption overwrite_option, | 66 CopyOverWriteOption overwrite_option, |
| 66 const std::wstring& alternative_path = L""); | 67 // TODO(amit): default args are disallowed by style guide. |
| 68 const FilePath& alternative_path = FilePath()); | |
|
Avi (use Gerrit)
2011/01/26 22:00:31
How many callers does this have? Can you just fix
| |
| 67 | 69 |
| 68 // Create a CreateDirWorkItem that creates a directory at the given path. | 70 // Create a CreateDirWorkItem that creates a directory at the given path. |
| 69 static CreateDirWorkItem* CreateCreateDirWorkItem(const FilePath& path); | 71 static CreateDirWorkItem* CreateCreateDirWorkItem(const FilePath& path); |
| 70 | 72 |
| 71 // Create a CreateRegKeyWorkItem that creates a registry key at the given | 73 // Create a CreateRegKeyWorkItem that creates a registry key at the given |
| 72 // path. | 74 // path. |
| 73 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem( | 75 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem( |
| 74 HKEY predefined_root, const std::wstring& path); | 76 HKEY predefined_root, const std::wstring& path); |
| 75 | 77 |
| 76 // Create a DeleteRegKeyWorkItem that deletes a registry key at the given | 78 // Create a DeleteRegKeyWorkItem that deletes a registry key at the given |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 WorkItem(); | 175 WorkItem(); |
| 174 | 176 |
| 175 // Specifies whether this work item my fail to complete and yet still | 177 // Specifies whether this work item my fail to complete and yet still |
| 176 // return true from Do(). | 178 // return true from Do(). |
| 177 bool ignore_failure_; | 179 bool ignore_failure_; |
| 178 | 180 |
| 179 std::string log_message_; | 181 std::string log_message_; |
| 180 }; | 182 }; |
| 181 | 183 |
| 182 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ | 184 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ |
| OLD | NEW |