| 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 "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "chrome/installer/util/work_item.h" | 10 #include "chrome/installer/util/work_item.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // should be on the same volume; otherwise, the move will be simulated | 26 // should be on the same volume; otherwise, the move will be simulated |
| 27 // by a copy-and-delete operation. | 27 // by a copy-and-delete operation. |
| 28 DeleteTreeWorkItem(const base::FilePath& root_path, | 28 DeleteTreeWorkItem(const base::FilePath& root_path, |
| 29 const base::FilePath& temp_path); | 29 const base::FilePath& temp_path); |
| 30 | 30 |
| 31 // WorkItem: | 31 // WorkItem: |
| 32 bool DoImpl() override; | 32 bool DoImpl() override; |
| 33 void RollbackImpl() override; | 33 void RollbackImpl() override; |
| 34 | 34 |
| 35 // Return temporary path for work based on |backup_path_| and |root_path_|. | 35 // Return temporary path for work based on |backup_path_| and |root_path_|. |
| 36 base::FilePath GetBackupPath(); | 36 const base::FilePath& GetBackupPath(); |
| 37 | 37 |
| 38 // Attempts to delete |root_path_|. Returns true on success. | 38 // Attempts to delete |root_path_|. Returns true on success. |
| 39 bool DeleteRoot(); | 39 bool DeleteRoot(); |
| 40 | 40 |
| 41 // Attempts to move |root_path_| to backup. Returns true on success. | 41 // Attempts to move |root_path_| to backup. Returns true on success. |
| 42 bool MoveRootToBackup(); | 42 bool MoveRootToBackup(); |
| 43 | 43 |
| 44 // Root path to delete. | 44 // Root path to delete. |
| 45 const base::FilePath root_path_; | 45 const base::FilePath root_path_; |
| 46 | 46 |
| 47 // Temporary directory that can be used. | 47 // Temporary directory that can be used. |
| 48 const base::FilePath temp_path_; | 48 const base::FilePath temp_path_; |
| 49 | 49 |
| 50 // The temporary directory into which the original root_path_ has been moved. | 50 // The temporary directory into which the original root_path_ has been moved. |
| 51 base::ScopedTempDir backup_path_; | 51 base::ScopedTempDir backup_dir_; |
| 52 |
| 53 // Caches the return value of GetBackupPath(). This is empty if |backup_dir_| |
| 54 // has not been created. |
| 55 base::FilePath backup_path_; |
| 52 | 56 |
| 53 // Set to true once root_path_ has been moved into backup_path_. | 57 // Set to true once root_path_ has been moved into backup_path_. |
| 54 bool moved_to_backup_ = false; | 58 bool moved_to_backup_ = false; |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ | 61 #endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_ |
| OLD | NEW |