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 <windows.h> 8 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" 21 22 WorkItem::WorkItem() : ignore_failure_(false) { 23 } 24 25 WorkItem::~WorkItem() { 26 } 27 28 CallbackWorkItem* WorkItem::CreateCallbackWorkItem( 29 base::Callback<bool(const CallbackWorkItem&)> callback) { 30 return new CallbackWorkItem(callback); 31 } 32 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); 41 } 42 43 CreateDirWorkItem* WorkItem::CreateCreateDirWorkItem( 44 const base::FilePath& path) { 45 return new CreateDirWorkItem(path); 46 } 47 48 CreateRegKeyWorkItem* WorkItem::CreateCreateRegKeyWorkItem( 49 HKEY predefined_root, 50 const std::wstring& path, 51 REGSAM wow64_access) { 52 return new CreateRegKeyWorkItem(predefined_root, path, wow64_access); 53 } 54 55 DeleteRegKeyWorkItem* WorkItem::CreateDeleteRegKeyWorkItem( 56 HKEY predefined_root, 57 const std::wstring& path, 58 REGSAM wow64_access) { 59 return new DeleteRegKeyWorkItem(predefined_root, path, wow64_access); 60 } 61 62 DeleteRegValueWorkItem* WorkItem::CreateDeleteRegValueWorkItem( 63 HKEY predefined_root, 64 const std::wstring& key_path, 65 REGSAM wow64_access, 66 const std::wstring& value_name) { 67 return new DeleteRegValueWorkItem( 68 predefined_root, key_path, wow64_access, value_name); 69 } 70 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); 76 } 77 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, 84 dest_path, 85 temp_dir, 86 duplicate_option); 87 } 88 89 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( 90 HKEY predefined_root, 91 const std::wstring& key_path, 92 REGSAM wow64_access, 93 const std::wstring& value_name, 94 const std::wstring& value_data, 95 bool overwrite) { 96 return new SetRegValueWorkItem(predefined_root, 97 key_path, 98 wow64_access, 99 value_name, 100 value_data, 101 overwrite); 102 } 103 104 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( 105 HKEY predefined_root, 106 const std::wstring& key_path, 107 REGSAM wow64_access, 108 const std::wstring& value_name, 109 DWORD value_data, 110 bool overwrite) { 111 return new SetRegValueWorkItem(predefined_root, 112 key_path, 113 wow64_access, 114 value_name, 115 value_data, 116 overwrite); 117 } 118 119 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( 120 HKEY predefined_root, 121 const std::wstring& key_path, 122 REGSAM wow64_access, 123 const std::wstring& value_name, 124 int64 value_data, 125 bool overwrite) { 126 return new SetRegValueWorkItem(predefined_root, 127 key_path, 128 wow64_access, 129 value_name, 130 value_data, 131 overwrite); 132 } 133 134 SelfRegWorkItem* WorkItem::CreateSelfRegWorkItem(const std::wstring& dll_path, 135 bool do_register, 136 bool user_level_registration) { 137 return new SelfRegWorkItem(dll_path, do_register, user_level_registration); 138 } 139 140 WorkItemList* WorkItem::CreateWorkItemList() { 141 return new WorkItemList(); 142 } 143 144 // static 145 WorkItemList* WorkItem::CreateNoRollbackWorkItemList() { 146 return new NoRollbackWorkItemList(); 147 } 148 149 WorkItemList* WorkItem::CreateConditionalWorkItemList(Condition* condition) { 150 return new ConditionalWorkItemList(condition); 151 } 152