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
3 // found in the LICENSE file.
5 #include "chrome/installer/util/work_item.h"
9 #include "chrome/installer/util/callback_work_item.h"
10 #include "chrome/installer/util/conditional_work_item_list.h"
11 #include "chrome/installer/util/copy_tree_work_item.h"
12 #include "chrome/installer/util/create_dir_work_item.h"
13 #include "chrome/installer/util/create_reg_key_work_item.h"
14 #include "chrome/installer/util/delete_tree_work_item.h"
15 #include "chrome/installer/util/delete_reg_key_work_item.h"
16 #include "chrome/installer/util/delete_reg_value_work_item.h"
17 #include "chrome/installer/util/move_tree_work_item.h"
18 #include "chrome/installer/util/self_reg_work_item.h"
19 #include "chrome/installer/util/set_reg_value_work_item.h"
20 #include "chrome/installer/util/work_item_list.h"
22 WorkItem::WorkItem() : ignore_failure_(false) {
25 WorkItem::~WorkItem() {
28 CallbackWorkItem
* WorkItem::CreateCallbackWorkItem(
29 base::Callback
<bool(const CallbackWorkItem
&)> callback
) {
30 return new CallbackWorkItem(callback
);
33 CopyTreeWorkItem
* WorkItem::CreateCopyTreeWorkItem(
34 const base::FilePath
& source_path
,
35 const base::FilePath
& dest_path
,
36 const base::FilePath
& temp_dir
,
37 CopyOverWriteOption overwrite_option
,
38 const base::FilePath
& alternative_path
) {
39 return new CopyTreeWorkItem(source_path
, dest_path
, temp_dir
,
40 overwrite_option
, alternative_path
);
43 CreateDirWorkItem
* WorkItem::CreateCreateDirWorkItem(
44 const base::FilePath
& path
) {
45 return new CreateDirWorkItem(path
);
48 CreateRegKeyWorkItem
* WorkItem::CreateCreateRegKeyWorkItem(
50 const std::wstring
& path
,
51 REGSAM wow64_access
) {
52 return new CreateRegKeyWorkItem(predefined_root
, path
, wow64_access
);
55 DeleteRegKeyWorkItem
* WorkItem::CreateDeleteRegKeyWorkItem(
57 const std::wstring
& path
,
58 REGSAM wow64_access
) {
59 return new DeleteRegKeyWorkItem(predefined_root
, path
, wow64_access
);
62 DeleteRegValueWorkItem
* WorkItem::CreateDeleteRegValueWorkItem(
64 const std::wstring
& key_path
,
66 const std::wstring
& value_name
) {
67 return new DeleteRegValueWorkItem(
68 predefined_root
, key_path
, wow64_access
, value_name
);
71 DeleteTreeWorkItem
* WorkItem::CreateDeleteTreeWorkItem(
72 const base::FilePath
& root_path
,
73 const base::FilePath
& temp_path
,
74 const std::vector
<base::FilePath
>& key_paths
) {
75 return new DeleteTreeWorkItem(root_path
, temp_path
, key_paths
);
78 MoveTreeWorkItem
* WorkItem::CreateMoveTreeWorkItem(
79 const base::FilePath
& source_path
,
80 const base::FilePath
& dest_path
,
81 const base::FilePath
& temp_dir
,
82 MoveTreeOption duplicate_option
) {
83 return new MoveTreeWorkItem(source_path
,
89 SetRegValueWorkItem
* WorkItem::CreateSetRegValueWorkItem(
91 const std::wstring
& key_path
,
93 const std::wstring
& value_name
,
94 const std::wstring
& value_data
,
96 return new SetRegValueWorkItem(predefined_root
,
104 SetRegValueWorkItem
* WorkItem::CreateSetRegValueWorkItem(
105 HKEY predefined_root
,
106 const std::wstring
& key_path
,
108 const std::wstring
& value_name
,
111 return new SetRegValueWorkItem(predefined_root
,
119 SetRegValueWorkItem
* WorkItem::CreateSetRegValueWorkItem(
120 HKEY predefined_root
,
121 const std::wstring
& key_path
,
123 const std::wstring
& value_name
,
126 return new SetRegValueWorkItem(predefined_root
,
134 SetRegValueWorkItem
* WorkItem::CreateSetRegValueWorkItem(
135 HKEY predefined_root
,
136 const std::wstring
& key_path
,
138 const std::wstring
& value_name
,
139 const GetValueFromExistingCallback
& get_value_callback
) {
140 return new SetRegValueWorkItem(predefined_root
,
147 SelfRegWorkItem
* WorkItem::CreateSelfRegWorkItem(const std::wstring
& dll_path
,
149 bool user_level_registration
) {
150 return new SelfRegWorkItem(dll_path
, do_register
, user_level_registration
);
153 WorkItemList
* WorkItem::CreateWorkItemList() {
154 return new WorkItemList();
158 WorkItemList
* WorkItem::CreateNoRollbackWorkItemList() {
159 return new NoRollbackWorkItemList();
162 WorkItemList
* WorkItem::CreateConditionalWorkItemList(Condition
* condition
) {
163 return new ConditionalWorkItemList(condition
);