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
3 // found in the LICENSE file.
5 #ifndef CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_
6 #define CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_
10 #include "base/files/file_path.h"
11 #include "chrome/installer/util/work_item.h"
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.
15 class CreateDirWorkItem
: public WorkItem
{
17 virtual ~CreateDirWorkItem();
21 // Rollback tries to remove all directories created along the path.
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
25 virtual void Rollback();
28 friend class WorkItem
;
30 explicit CreateDirWorkItem(const base::FilePath
& path
);
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,
34 // "top_path_" is set to empty string.
35 void GetTopDirToCreate();
37 // Path of the directory to be created.
40 // The top most directory that needs to be created.
41 base::FilePath top_path_
;
43 bool rollback_needed_
;
46 #endif // CHROME_INSTALLER_UTIL_CREATE_DIR_WORK_ITEM_H_