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_COPY_TREE_WORK_ITEM_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ |
6 #define CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ | 6 #define CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" |
9 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
10 #include "base/scoped_temp_dir.h" | |
11 #include "chrome/installer/util/work_item.h" | 11 #include "chrome/installer/util/work_item.h" |
12 | 12 |
13 // A WorkItem subclass that recursively copies a file system hierarchy from | 13 // A WorkItem subclass that recursively copies a file system hierarchy from |
14 // source path to destination path. It also creates all necessary intermediate | 14 // source path to destination path. It also creates all necessary intermediate |
15 // paths of the destination path if they do not exist. The file system | 15 // paths of the destination path if they do not exist. The file system |
16 // hierarchy could be a single file, or a directory. | 16 // hierarchy could be a single file, or a directory. |
17 // Under the cover CopyTreeWorkItem moves the destination path, if existing, | 17 // Under the cover CopyTreeWorkItem moves the destination path, if existing, |
18 // to the temporary directory passed in, and then copies the source hierarchy | 18 // to the temporary directory passed in, and then copies the source hierarchy |
19 // to the destination location. During rollback the original destination | 19 // to the destination location. During rollback the original destination |
20 // hierarchy is moved back. | 20 // hierarchy is moved back. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 // Whether the original files have been moved to backup path under | 71 // Whether the original files have been moved to backup path under |
72 // temporary directory. If true, moving back is needed during rollback. | 72 // temporary directory. If true, moving back is needed during rollback. |
73 bool moved_to_backup_; | 73 bool moved_to_backup_; |
74 | 74 |
75 // Whether the source was copied to alternative_path_ because dest_path_ | 75 // Whether the source was copied to alternative_path_ because dest_path_ |
76 // existed and was in use. Needed during rollback. | 76 // existed and was in use. Needed during rollback. |
77 bool copied_to_alternate_path_; | 77 bool copied_to_alternate_path_; |
78 | 78 |
79 // The temporary directory into which the original dest_path_ has been moved. | 79 // The temporary directory into which the original dest_path_ has been moved. |
80 ScopedTempDir backup_path_; | 80 base::ScopedTempDir backup_path_; |
81 | 81 |
82 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileSameContent); | 82 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileSameContent); |
83 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUse); | 83 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUse); |
84 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileAndCleanup); | 84 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileAndCleanup); |
85 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, NewNameAndCopyTest); | 85 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, NewNameAndCopyTest); |
86 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUseAndCleanup); | 86 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUseAndCleanup); |
87 }; | 87 }; |
88 | 88 |
89 #endif // CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ | 89 #endif // CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ |
OLD | NEW |