| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/installer/util/work_item.h" | 5 #include "chrome/installer/util/work_item.h" |
| 6 | 6 |
| 7 #include "chrome/installer/util/conditional_work_item_list.h" | 7 #include "chrome/installer/util/conditional_work_item_list.h" |
| 8 #include "chrome/installer/util/copy_reg_key_work_item.h" | 8 #include "chrome/installer/util/copy_reg_key_work_item.h" |
| 9 #include "chrome/installer/util/copy_tree_work_item.h" | 9 #include "chrome/installer/util/copy_tree_work_item.h" |
| 10 #include "chrome/installer/util/create_dir_work_item.h" | 10 #include "chrome/installer/util/create_dir_work_item.h" |
| 11 #include "chrome/installer/util/create_reg_key_work_item.h" | 11 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 12 #include "chrome/installer/util/delete_tree_work_item.h" | 12 #include "chrome/installer/util/delete_tree_work_item.h" |
| 13 #include "chrome/installer/util/delete_reg_key_work_item.h" | 13 #include "chrome/installer/util/delete_reg_key_work_item.h" |
| 14 #include "chrome/installer/util/delete_reg_value_work_item.h" | 14 #include "chrome/installer/util/delete_reg_value_work_item.h" |
| 15 #include "chrome/installer/util/file_from_template_work_item.h" |
| 15 #include "chrome/installer/util/move_tree_work_item.h" | 16 #include "chrome/installer/util/move_tree_work_item.h" |
| 16 #include "chrome/installer/util/self_reg_work_item.h" | 17 #include "chrome/installer/util/self_reg_work_item.h" |
| 17 #include "chrome/installer/util/set_reg_value_work_item.h" | 18 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 18 #include "chrome/installer/util/work_item_list.h" | 19 #include "chrome/installer/util/work_item_list.h" |
| 19 | 20 |
| 20 WorkItem::WorkItem() : ignore_failure_(false) { | 21 WorkItem::WorkItem() : ignore_failure_(false) { |
| 21 } | 22 } |
| 22 | 23 |
| 23 WorkItem::~WorkItem() { | 24 WorkItem::~WorkItem() { |
| 24 } | 25 } |
| 25 | 26 |
| 26 CopyRegKeyWorkItem* WorkItem::CreateCopyRegKeyWorkItem( | 27 CopyRegKeyWorkItem* WorkItem::CreateCopyRegKeyWorkItem( |
| 27 HKEY predefined_root, | 28 HKEY predefined_root, |
| 28 const std::wstring& source_key_path, | 29 const string16& source_key_path, |
| 29 const std::wstring& dest_key_path, | 30 const string16& dest_key_path, |
| 30 CopyOverWriteOption overwrite_option) { | 31 CopyOverWriteOption overwrite_option) { |
| 31 return new CopyRegKeyWorkItem(predefined_root, source_key_path, | 32 return new CopyRegKeyWorkItem(predefined_root, source_key_path, |
| 32 dest_key_path, overwrite_option); | 33 dest_key_path, overwrite_option); |
| 33 } | 34 } |
| 34 | 35 |
| 35 CopyTreeWorkItem* WorkItem::CreateCopyTreeWorkItem( | 36 CopyTreeWorkItem* WorkItem::CreateCopyTreeWorkItem( |
| 36 const FilePath& source_path, | 37 const FilePath& source_path, |
| 37 const FilePath& dest_path, | 38 const FilePath& dest_path, |
| 38 const FilePath& temp_dir, | 39 const FilePath& temp_dir, |
| 39 CopyOverWriteOption overwrite_option, | 40 CopyOverWriteOption overwrite_option, |
| 40 const FilePath& alternative_path) { | 41 const FilePath& alternative_path) { |
| 41 return new CopyTreeWorkItem(source_path, dest_path, temp_dir, | 42 return new CopyTreeWorkItem(source_path, dest_path, temp_dir, |
| 42 overwrite_option, alternative_path); | 43 overwrite_option, alternative_path); |
| 43 } | 44 } |
| 44 | 45 |
| 45 CreateDirWorkItem* WorkItem::CreateCreateDirWorkItem(const FilePath& path) { | 46 CreateDirWorkItem* WorkItem::CreateCreateDirWorkItem(const FilePath& path) { |
| 46 return new CreateDirWorkItem(path); | 47 return new CreateDirWorkItem(path); |
| 47 } | 48 } |
| 48 | 49 |
| 49 CreateRegKeyWorkItem* WorkItem::CreateCreateRegKeyWorkItem( | 50 CreateRegKeyWorkItem* WorkItem::CreateCreateRegKeyWorkItem( |
| 50 HKEY predefined_root, const std::wstring& path) { | 51 HKEY predefined_root, const string16& path) { |
| 51 return new CreateRegKeyWorkItem(predefined_root, path); | 52 return new CreateRegKeyWorkItem(predefined_root, path); |
| 52 } | 53 } |
| 53 | 54 |
| 54 DeleteRegKeyWorkItem* WorkItem::CreateDeleteRegKeyWorkItem( | 55 DeleteRegKeyWorkItem* WorkItem::CreateDeleteRegKeyWorkItem( |
| 55 HKEY predefined_root, const std::wstring& path) { | 56 HKEY predefined_root, const string16& path) { |
| 56 return new DeleteRegKeyWorkItem(predefined_root, path); | 57 return new DeleteRegKeyWorkItem(predefined_root, path); |
| 57 } | 58 } |
| 58 | 59 |
| 59 DeleteRegValueWorkItem* WorkItem::CreateDeleteRegValueWorkItem( | 60 DeleteRegValueWorkItem* WorkItem::CreateDeleteRegValueWorkItem( |
| 60 HKEY predefined_root, | 61 HKEY predefined_root, |
| 61 const std::wstring& key_path, | 62 const string16& key_path, |
| 62 const std::wstring& value_name) { | 63 const string16& value_name) { |
| 63 return new DeleteRegValueWorkItem(predefined_root, key_path, value_name); | 64 return new DeleteRegValueWorkItem(predefined_root, key_path, value_name); |
| 64 } | 65 } |
| 65 | 66 |
| 66 DeleteTreeWorkItem* WorkItem::CreateDeleteTreeWorkItem( | 67 DeleteTreeWorkItem* WorkItem::CreateDeleteTreeWorkItem( |
| 67 const FilePath& root_path, | 68 const FilePath& root_path, |
| 68 const FilePath& temp_path, | 69 const FilePath& temp_path, |
| 69 const std::vector<FilePath>& key_paths) { | 70 const std::vector<FilePath>& key_paths) { |
| 70 return new DeleteTreeWorkItem(root_path, temp_path, key_paths); | 71 return new DeleteTreeWorkItem(root_path, temp_path, key_paths); |
| 71 } | 72 } |
| 72 | 73 |
| 74 FileFromTemplateWorkItem* WorkItem::CreateFileFromTemplateWorkItem( |
| 75 const FilePath& source_path, |
| 76 const FilePath& dest_path, |
| 77 const FilePath& temp_dir, |
| 78 const std::map<string16, string16>& mappings) { |
| 79 return new FileFromTemplateWorkItem(source_path, |
| 80 dest_path, |
| 81 temp_dir, |
| 82 mappings); |
| 83 } |
| 84 |
| 73 MoveTreeWorkItem* WorkItem::CreateMoveTreeWorkItem( | 85 MoveTreeWorkItem* WorkItem::CreateMoveTreeWorkItem( |
| 74 const FilePath& source_path, | 86 const FilePath& source_path, |
| 75 const FilePath& dest_path, | 87 const FilePath& dest_path, |
| 76 const FilePath& temp_dir, | 88 const FilePath& temp_dir, |
| 77 MoveTreeOption duplicate_option) { | 89 MoveTreeOption duplicate_option) { |
| 78 return new MoveTreeWorkItem(source_path, | 90 return new MoveTreeWorkItem(source_path, |
| 79 dest_path, | 91 dest_path, |
| 80 temp_dir, | 92 temp_dir, |
| 81 duplicate_option); | 93 duplicate_option); |
| 82 } | 94 } |
| 83 | 95 |
| 84 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( | 96 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( |
| 85 HKEY predefined_root, | 97 HKEY predefined_root, |
| 86 const std::wstring& key_path, | 98 const string16& key_path, |
| 87 const std::wstring& value_name, | 99 const string16& value_name, |
| 88 const std::wstring& value_data, | 100 const string16& value_data, |
| 89 bool overwrite) { | 101 bool overwrite) { |
| 90 return new SetRegValueWorkItem(predefined_root, key_path, | 102 return new SetRegValueWorkItem(predefined_root, key_path, |
| 91 value_name, value_data, overwrite); | 103 value_name, value_data, overwrite); |
| 92 } | 104 } |
| 93 | 105 |
| 94 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( | 106 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( |
| 95 HKEY predefined_root, | 107 HKEY predefined_root, |
| 96 const std::wstring& key_path, | 108 const string16& key_path, |
| 97 const std::wstring& value_name, | 109 const string16& value_name, |
| 98 DWORD value_data, | 110 DWORD value_data, |
| 99 bool overwrite) { | 111 bool overwrite) { |
| 100 return new SetRegValueWorkItem(predefined_root, key_path, | 112 return new SetRegValueWorkItem(predefined_root, key_path, |
| 101 value_name, value_data, overwrite); | 113 value_name, value_data, overwrite); |
| 102 } | 114 } |
| 103 | 115 |
| 104 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( | 116 SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem( |
| 105 HKEY predefined_root, | 117 HKEY predefined_root, |
| 106 const std::wstring& key_path, | 118 const string16& key_path, |
| 107 const std::wstring& value_name, | 119 const string16& value_name, |
| 108 int64 value_data, | 120 int64 value_data, |
| 109 bool overwrite) { | 121 bool overwrite) { |
| 110 return new SetRegValueWorkItem(predefined_root, key_path, | 122 return new SetRegValueWorkItem(predefined_root, key_path, |
| 111 value_name, value_data, overwrite); | 123 value_name, value_data, overwrite); |
| 112 } | 124 } |
| 113 | 125 |
| 114 SelfRegWorkItem* WorkItem::CreateSelfRegWorkItem(const std::wstring& dll_path, | 126 SelfRegWorkItem* WorkItem::CreateSelfRegWorkItem(const string16& dll_path, |
| 115 bool do_register, | 127 bool do_register, |
| 116 bool user_level_registration) { | 128 bool user_level_registration) { |
| 117 return new SelfRegWorkItem(dll_path, do_register, user_level_registration); | 129 return new SelfRegWorkItem(dll_path, do_register, user_level_registration); |
| 118 } | 130 } |
| 119 | 131 |
| 120 WorkItemList* WorkItem::CreateWorkItemList() { | 132 WorkItemList* WorkItem::CreateWorkItemList() { |
| 121 return new WorkItemList(); | 133 return new WorkItemList(); |
| 122 } | 134 } |
| 123 | 135 |
| 124 // static | 136 // static |
| 125 WorkItemList* WorkItem::CreateNoRollbackWorkItemList() { | 137 WorkItemList* WorkItem::CreateNoRollbackWorkItemList() { |
| 126 return new NoRollbackWorkItemList(); | 138 return new NoRollbackWorkItemList(); |
| 127 } | 139 } |
| 128 | 140 |
| 129 WorkItemList* WorkItem::CreateConditionalWorkItemList(Condition* condition) { | 141 WorkItemList* WorkItem::CreateConditionalWorkItemList(Condition* condition) { |
| 130 return new ConditionalWorkItemList(condition); | 142 return new ConditionalWorkItemList(condition); |
| 131 } | 143 } |
| OLD | NEW |