| 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_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 #include "chrome/installer/util/work_item.h" | 10 #include "chrome/installer/util/work_item.h" |
| 11 | 11 |
| 12 // 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 |
| 13 // 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 |
| 14 // directory. | 14 // directory. |
| 15 // 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 |
| 16 // 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. |
| 17 class DeleteTreeWorkItem : public WorkItem { | 17 class DeleteTreeWorkItem : public WorkItem { |
| 18 public: | 18 public: |
| 19 virtual ~DeleteTreeWorkItem(); | 19 virtual ~DeleteTreeWorkItem(); |
| 20 | 20 |
| 21 virtual bool Do(); | 21 virtual bool Do(); |
| 22 | 22 |
| 23 virtual void Rollback(); | 23 virtual void Rollback(); |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 friend class WorkItem; | 26 friend class WorkItem; |
| 27 | 27 |
| 28 // 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_ |
| 29 bool GetBackupPath(std::wstring for_path, std::wstring* backup_path); | 29 bool GetBackupPath(const std::wstring& for_path, std::wstring* backup_path); |
| 30 | 30 |
| 31 DeleteTreeWorkItem(std::wstring root_path, std::wstring key_path); | 31 DeleteTreeWorkItem(const std::wstring& root_path, |
| 32 const std::wstring& key_path); |
| 32 | 33 |
| 33 // Root path to delete. | 34 // Root path to delete. |
| 34 std::wstring root_path_; | 35 std::wstring root_path_; |
| 35 | 36 |
| 36 // 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 |
| 37 // performed only if the key file is not in use. | 38 // performed only if the key file is not in use. |
| 38 std::wstring key_path_; | 39 std::wstring key_path_; |
| 39 | 40 |
| 40 // 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 |
| 41 // been moved to. | 42 // been moved to. |
| 42 std::wstring backup_path_; | 43 std::wstring backup_path_; |
| 43 | 44 |
| 44 // 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 |
| 45 // been moved to. | 46 // been moved to. |
| 46 std::wstring key_backup_path_; | 47 std::wstring key_backup_path_; |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H__ | 50 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ |
| OLD | NEW |