- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / installer / util / work_item.cc
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.
4
5 #include "chrome/installer/util/work_item.h"
6
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"
20
21 WorkItem::WorkItem() : ignore_failure_(false) {
22 }
23
24 WorkItem::~WorkItem() {
25 }
26
27 CallbackWorkItem* WorkItem::CreateCallbackWorkItem(
28     base::Callback<bool(const CallbackWorkItem&)> callback) {
29   return new CallbackWorkItem(callback);
30 }
31
32 CopyRegKeyWorkItem* WorkItem::CreateCopyRegKeyWorkItem(
33     HKEY predefined_root,
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);
39 }
40
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);
49 }
50
51 CreateDirWorkItem* WorkItem::CreateCreateDirWorkItem(
52     const base::FilePath& path) {
53   return new CreateDirWorkItem(path);
54 }
55
56 CreateRegKeyWorkItem* WorkItem::CreateCreateRegKeyWorkItem(
57     HKEY predefined_root, const std::wstring& path) {
58   return new CreateRegKeyWorkItem(predefined_root, path);
59 }
60
61 DeleteRegKeyWorkItem* WorkItem::CreateDeleteRegKeyWorkItem(
62     HKEY predefined_root, const std::wstring& path) {
63   return new DeleteRegKeyWorkItem(predefined_root, path);
64 }
65
66 DeleteRegValueWorkItem* WorkItem::CreateDeleteRegValueWorkItem(
67     HKEY predefined_root,
68     const std::wstring& key_path,
69     const std::wstring& value_name) {
70   return new DeleteRegValueWorkItem(predefined_root, key_path, value_name);
71 }
72
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);
78 }
79
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,
86                               dest_path,
87                               temp_dir,
88                               duplicate_option);
89 }
90
91 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem(
92     HKEY predefined_root,
93     const std::wstring& key_path,
94     const std::wstring& value_name,
95     const std::wstring& value_data,
96     bool overwrite) {
97   return new SetRegValueWorkItem(predefined_root, key_path,
98                                  value_name, value_data, overwrite);
99 }
100
101 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem(
102     HKEY predefined_root,
103     const std::wstring& key_path,
104     const std::wstring& value_name,
105     DWORD value_data,
106     bool overwrite) {
107   return new SetRegValueWorkItem(predefined_root, key_path,
108                                  value_name, value_data, overwrite);
109 }
110
111 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem(
112     HKEY predefined_root,
113     const std::wstring& key_path,
114     const std::wstring& value_name,
115     int64 value_data,
116     bool overwrite) {
117   return new SetRegValueWorkItem(predefined_root, key_path,
118                                  value_name, value_data, overwrite);
119 }
120
121 SelfRegWorkItem* WorkItem::CreateSelfRegWorkItem(const std::wstring& dll_path,
122                                                  bool do_register,
123                                                  bool user_level_registration) {
124   return new SelfRegWorkItem(dll_path, do_register, user_level_registration);
125 }
126
127 WorkItemList* WorkItem::CreateWorkItemList() {
128   return new WorkItemList();
129 }
130
131 // static
132 WorkItemList* WorkItem::CreateNoRollbackWorkItemList() {
133   return new NoRollbackWorkItemList();
134 }
135
136 WorkItemList* WorkItem::CreateConditionalWorkItemList(Condition* condition) {
137   return new ConditionalWorkItemList(condition);
138 }