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