| 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_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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/installer/util/work_item.h" | 13 #include "chrome/installer/util/work_item.h" |
| 14 | 14 |
| 15 // A WorkItem subclass that recursively deletes a file system hierarchy at the | 15 // A WorkItem subclass that recursively deletes a file system hierarchy at the |
| 16 // given root path. The file system hierarchy could be a single file, or a | 16 // given root path. The file system hierarchy could be a single file, or a |
| 17 // directory. | 17 // directory. |
| 18 // The file system hierarchy to be deleted can have one or more key files. If | 18 // The file system hierarchy to be deleted can have one or more key files. If |
| 19 // specified, deletion will be performed only if all key files are not in use. | 19 // specified, deletion will be performed only if all key files are not in use. |
| 20 class DeleteTreeWorkItem : public WorkItem { | 20 class DeleteTreeWorkItem : public WorkItem { |
| 21 public: | 21 public: |
| 22 virtual ~DeleteTreeWorkItem(); | 22 ~DeleteTreeWorkItem() override; |
| 23 | 23 |
| 24 virtual bool Do(); | 24 bool Do() override; |
| 25 | 25 |
| 26 virtual void Rollback(); | 26 void Rollback() override; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 friend class WorkItem; | 29 friend class WorkItem; |
| 30 | 30 |
| 31 DeleteTreeWorkItem(const base::FilePath& root_path, | 31 DeleteTreeWorkItem(const base::FilePath& root_path, |
| 32 const base::FilePath& temp_path, | 32 const base::FilePath& temp_path, |
| 33 const std::vector<base::FilePath>& key_paths); | 33 const std::vector<base::FilePath>& key_paths); |
| 34 | 34 |
| 35 // Root path to delete. | 35 // Root path to delete. |
| 36 base::FilePath root_path_; | 36 base::FilePath root_path_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 scoped_ptr<base::ScopedTempDir[]> key_backup_paths_; | 51 scoped_ptr<base::ScopedTempDir[]> key_backup_paths_; |
| 52 | 52 |
| 53 // The temporary directory into which the original root_path_ has been moved. | 53 // The temporary directory into which the original root_path_ has been moved. |
| 54 base::ScopedTempDir backup_path_; | 54 base::ScopedTempDir backup_path_; |
| 55 | 55 |
| 56 // Set to true once root_path_ has been copied into backup_path_. | 56 // Set to true once root_path_ has been copied into backup_path_. |
| 57 bool copied_to_backup_; | 57 bool copied_to_backup_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ | 60 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ |
| OLD | NEW |