| OLD | NEW |
| 1 // Copyright (c) 2009 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_DELETE_TREE_WORK_ITEM_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ |
| 6 #define CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ | 6 #define CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | |
| 11 #include "base/file_path.h" | |
| 12 #include "chrome/installer/util/work_item.h" | 10 #include "chrome/installer/util/work_item.h" |
| 13 | 11 |
| 14 // A WorkItem subclass that recursively deletes a file system hierarchy at the | 12 // A WorkItem subclass that recursively deletes a file system hierarchy at the |
| 15 // given root path. The file system hierarchy could be a single file, or a | 13 // given root path. The file system hierarchy could be a single file, or a |
| 16 // directory. | 14 // directory. |
| 17 // The file system hierarchy to be deleted can have a key file. If the key file | 15 // The file system hierarchy to be deleted can have a key file. If the key file |
| 18 // is specified, deletion will be performed only if the key file is not in use. | 16 // is specified, deletion will be performed only if the key file is not in use. |
| 19 class DeleteTreeWorkItem : public WorkItem { | 17 class DeleteTreeWorkItem : public WorkItem { |
| 20 public: | 18 public: |
| 21 virtual ~DeleteTreeWorkItem(); | 19 virtual ~DeleteTreeWorkItem(); |
| 22 | 20 |
| 23 virtual bool Do(); | 21 virtual bool Do(); |
| 24 | 22 |
| 25 virtual void Rollback(); | 23 virtual void Rollback(); |
| 26 | 24 |
| 27 private: | 25 private: |
| 28 friend class WorkItem; | 26 friend class WorkItem; |
| 29 | 27 |
| 30 // Get a backup path that can keep root_path_ or key_path_ | 28 // Get a backup path that can keep root_path_ or key_path_ |
| 31 bool GetBackupPath(const FilePath& for_path, FilePath* backup_path); | 29 bool GetBackupPath(const std::wstring& for_path, std::wstring* backup_path); |
| 32 | 30 |
| 33 DeleteTreeWorkItem(const std::wstring& root_path, | 31 DeleteTreeWorkItem(const std::wstring& root_path, |
| 34 const std::wstring& key_path); | 32 const std::wstring& key_path); |
| 35 | 33 |
| 36 // Root path to delete. | 34 // Root path to delete. |
| 37 FilePath root_path_; | 35 std::wstring root_path_; |
| 38 | 36 |
| 39 // Path to the key file. If the key file is specified, deletion will be | 37 // Path to the key file. If the key file is specified, deletion will be |
| 40 // performed only if the key file is not in use. | 38 // performed only if the key file is not in use. |
| 41 FilePath key_path_; | 39 std::wstring key_path_; |
| 42 | 40 |
| 43 // The full path in temporary directory that the original root_path_ has | 41 // The full path in temporary directory that the original root_path_ has |
| 44 // been moved to. | 42 // been moved to. |
| 45 FilePath backup_path_; | 43 std::wstring backup_path_; |
| 46 | 44 |
| 47 // The full path in temporary directory that the original key_path_ has | 45 // The full path in temporary directory that the original key_path_ has |
| 48 // been moved to. | 46 // been moved to. |
| 49 FilePath key_backup_path_; | 47 std::wstring key_backup_path_; |
| 50 }; | 48 }; |
| 51 | 49 |
| 52 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ | 50 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ |
| OLD | NEW |