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_CREATE_DIR_WORK_ITEM_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_ |
6 #define CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_ | 6 #define CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "chrome/installer/util/work_item.h" | 11 #include "chrome/installer/util/work_item.h" |
12 | 12 |
13 // A WorkItem subclass that creates a directory with the specified path. | 13 // A WorkItem subclass that creates a directory with the specified path. |
14 // It also creates all necessary intermediate paths if they do not exist. | 14 // It also creates all necessary intermediate paths if they do not exist. |
15 class CreateDirWorkItem : public WorkItem { | 15 class CreateDirWorkItem : public WorkItem { |
16 public: | 16 public: |
17 virtual ~CreateDirWorkItem(); | 17 ~CreateDirWorkItem() override; |
18 | 18 |
19 virtual bool Do(); | 19 bool Do() override; |
20 | 20 |
21 // Rollback tries to remove all directories created along the path. | 21 // Rollback tries to remove all directories created along the path. |
22 // If the leaf directory or one of the intermediate directories are not | 22 // If the leaf directory or one of the intermediate directories are not |
23 // empty, the non-empty directory and its parent directories will not be | 23 // empty, the non-empty directory and its parent directories will not be |
24 // removed. | 24 // removed. |
25 virtual void Rollback(); | 25 void Rollback() override; |
26 | 26 |
27 private: | 27 private: |
28 friend class WorkItem; | 28 friend class WorkItem; |
29 | 29 |
30 explicit CreateDirWorkItem(const base::FilePath& path); | 30 explicit CreateDirWorkItem(const base::FilePath& path); |
31 | 31 |
32 // Get the top most directory that needs to be created in order to create | 32 // Get the top most directory that needs to be created in order to create |
33 // "path_", and set "top_path_" accordingly. if "path_" already exists, | 33 // "path_", and set "top_path_" accordingly. if "path_" already exists, |
34 // "top_path_" is set to empty string. | 34 // "top_path_" is set to empty string. |
35 void GetTopDirToCreate(); | 35 void GetTopDirToCreate(); |
36 | 36 |
37 // Path of the directory to be created. | 37 // Path of the directory to be created. |
38 base::FilePath path_; | 38 base::FilePath path_; |
39 | 39 |
40 // The top most directory that needs to be created. | 40 // The top most directory that needs to be created. |
41 base::FilePath top_path_; | 41 base::FilePath top_path_; |
42 | 42 |
43 bool rollback_needed_; | 43 bool rollback_needed_; |
44 }; | 44 }; |
45 | 45 |
46 #endif // CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_ | 46 #endif // CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_ |
OLD | NEW |