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"
7 #include "chrome/installer/util/callback_work_item.h"
8 #include "chrome/installer/util/conditional_work_item_list.h"
9 #include "chrome/installer/util/copy_reg_key_work_item.h"
10 #include "chrome/installer/util/copy_tree_work_item.h"
11 #include "chrome/installer/util/create_dir_work_item.h"
12 #include "chrome/installer/util/create_reg_key_work_item.h"
13 #include "chrome/installer/util/delete_tree_work_item.h"
14 #include "chrome/installer/util/delete_reg_key_work_item.h"
15 #include "chrome/installer/util/delete_reg_value_work_item.h"
16 #include "chrome/installer/util/move_tree_work_item.h"
17 #include "chrome/installer/util/self_reg_work_item.h"
18 #include "chrome/installer/util/set_reg_value_work_item.h"
19 #include "chrome/installer/util/work_item_list.h"
21 WorkItem::WorkItem() : ignore_failure_(false) {
24 WorkItem::~WorkItem() {
27 CallbackWorkItem
* WorkItem::CreateCallbackWorkItem(
28 base::Callback
<bool(const CallbackWorkItem
&)> callback
) {
29 return new CallbackWorkItem(callback
);
32 CopyRegKeyWorkItem
* WorkItem::CreateCopyRegKeyWorkItem(
34 const std::wstring
& source_key_path
,
35 const std::wstring
& dest_key_path
,
36 CopyOverWriteOption overwrite_option
) {
37 return new CopyRegKeyWorkItem(predefined_root
, source_key_path
,
38 dest_key_path
, overwrite_option
);
41 CopyTreeWorkItem
* WorkItem::CreateCopyTreeWorkItem(
42 const base::FilePath
& source_path
,
43 const base::FilePath
& dest_path
,
44 const base::FilePath
& temp_dir
,
45 CopyOverWriteOption overwrite_option
,
46 const base::FilePath
& alternative_path
) {
47 return new CopyTreeWorkItem(source_path
, dest_path
, temp_dir
,
48 overwrite_option
, alternative_path
);
51 CreateDirWorkItem
* WorkItem::CreateCreateDirWorkItem(
52 const base::FilePath
& path
) {
53 return new CreateDirWorkItem(path
);
56 CreateRegKeyWorkItem
* WorkItem::CreateCreateRegKeyWorkItem(
57 HKEY predefined_root
, const std::wstring
& path
) {
58 return new CreateRegKeyWorkItem(predefined_root
, path
);
61 DeleteRegKeyWorkItem
* WorkItem::CreateDeleteRegKeyWorkItem(
62 HKEY predefined_root
, const std::wstring
& path
) {
63 return new DeleteRegKeyWorkItem(predefined_root
, path
);
66 DeleteRegValueWorkItem
* WorkItem::CreateDeleteRegValueWorkItem(
68 const std::wstring
& key_path
,
69 const std::wstring
& value_name
) {
70 return new DeleteRegValueWorkItem(predefined_root
, key_path
, value_name
);
73 DeleteTreeWorkItem
* WorkItem::CreateDeleteTreeWorkItem(
74 const base::FilePath
& root_path
,
75 const base::FilePath
& temp_path
,
76 const std::vector
<base::FilePath
>& key_paths
) {
77 return new DeleteTreeWorkItem(root_path
, temp_path
, key_paths
);
80 MoveTreeWorkItem
* WorkItem::CreateMoveTreeWorkItem(
81 const base::FilePath
& source_path
,
82 const base::FilePath
& dest_path
,
83 const base::FilePath
& temp_dir
,
84 MoveTreeOption duplicate_option
) {
85 return new MoveTreeWorkItem(source_path
,
91 SetRegValueWorkItem
* WorkItem::CreateSetRegValueWorkItem(
93 const std::wstring
& key_path
,
94 const std::wstring
& value_name
,
95 const std::wstring
& value_data
,
97 return new SetRegValueWorkItem(predefined_root
, key_path
,
98 value_name
, value_data
, overwrite
);
101 SetRegValueWorkItem
* WorkItem::CreateSetRegValueWorkItem(
102 HKEY predefined_root
,
103 const std::wstring
& key_path
,
104 const std::wstring
& value_name
,
107 return new SetRegValueWorkItem(predefined_root
, key_path
,
108 value_name
, value_data
, overwrite
);
111 SetRegValueWorkItem
* WorkItem::CreateSetRegValueWorkItem(
112 HKEY predefined_root
,
113 const std::wstring
& key_path
,
114 const std::wstring
& value_name
,
117 return new SetRegValueWorkItem(predefined_root
, key_path
,
118 value_name
, value_data
, overwrite
);
121 SelfRegWorkItem
* WorkItem::CreateSelfRegWorkItem(const std::wstring
& dll_path
,
123 bool user_level_registration
) {
124 return new SelfRegWorkItem(dll_path
, do_register
, user_level_registration
);
127 WorkItemList
* WorkItem::CreateWorkItemList() {
128 return new WorkItemList();
132 WorkItemList
* WorkItem::CreateNoRollbackWorkItemList() {
133 return new NoRollbackWorkItemList();
136 WorkItemList
* WorkItem::CreateConditionalWorkItemList(Condition
* condition
) {
137 return new ConditionalWorkItemList(condition
);