| 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_list.h" | 5 #include "chrome/installer/util/work_item_list.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "chrome/installer/util/logging_installer.h" | 9 #include "chrome/installer/util/logging_installer.h" |
| 10 #include "chrome/installer/util/callback_work_item.h" |
| 10 #include "chrome/installer/util/copy_reg_key_work_item.h" | 11 #include "chrome/installer/util/copy_reg_key_work_item.h" |
| 11 #include "chrome/installer/util/copy_tree_work_item.h" | 12 #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_dir_work_item.h" |
| 13 #include "chrome/installer/util/create_reg_key_work_item.h" | 14 #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_tree_work_item.h" |
| 15 #include "chrome/installer/util/delete_reg_key_work_item.h" | 16 #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/delete_reg_value_work_item.h" |
| 17 #include "chrome/installer/util/move_tree_work_item.h" | 18 #include "chrome/installer/util/move_tree_work_item.h" |
| 18 #include "chrome/installer/util/self_reg_work_item.h" | 19 #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/set_reg_value_work_item.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 67 |
| 67 status_ = LIST_ROLLED_BACK; | 68 status_ = LIST_ROLLED_BACK; |
| 68 return; | 69 return; |
| 69 } | 70 } |
| 70 | 71 |
| 71 void WorkItemList::AddWorkItem(WorkItem* work_item) { | 72 void WorkItemList::AddWorkItem(WorkItem* work_item) { |
| 72 DCHECK(status_ == ADD_ITEM); | 73 DCHECK(status_ == ADD_ITEM); |
| 73 list_.push_back(work_item); | 74 list_.push_back(work_item); |
| 74 } | 75 } |
| 75 | 76 |
| 77 WorkItem* WorkItemList::AddCallbackWorkItem( |
| 78 base::Callback<bool(const CallbackWorkItem&)> callback) { |
| 79 WorkItem* item = WorkItem::CreateCallbackWorkItem(callback); |
| 80 AddWorkItem(item); |
| 81 return item; |
| 82 } |
| 83 |
| 76 WorkItem* WorkItemList::AddCopyRegKeyWorkItem( | 84 WorkItem* WorkItemList::AddCopyRegKeyWorkItem( |
| 77 HKEY predefined_root, | 85 HKEY predefined_root, |
| 78 const std::wstring& source_key_path, | 86 const std::wstring& source_key_path, |
| 79 const std::wstring& dest_key_path, | 87 const std::wstring& dest_key_path, |
| 80 CopyOverWriteOption overwrite_option) { | 88 CopyOverWriteOption overwrite_option) { |
| 81 WorkItem* item = WorkItem::CreateCopyRegKeyWorkItem( | 89 WorkItem* item = WorkItem::CreateCopyRegKeyWorkItem( |
| 82 predefined_root, source_key_path, dest_key_path, overwrite_option); | 90 predefined_root, source_key_path, dest_key_path, overwrite_option); |
| 83 AddWorkItem(item); | 91 AddWorkItem(item); |
| 84 return item; | 92 return item; |
| 85 } | 93 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (result) | 239 if (result) |
| 232 VLOG(1) << "NoRollbackWorkItemList: list execution succeeded"; | 240 VLOG(1) << "NoRollbackWorkItemList: list execution succeeded"; |
| 233 | 241 |
| 234 status_ = LIST_EXECUTED; | 242 status_ = LIST_EXECUTED; |
| 235 return result; | 243 return result; |
| 236 } | 244 } |
| 237 | 245 |
| 238 void NoRollbackWorkItemList::Rollback() { | 246 void NoRollbackWorkItemList::Rollback() { |
| 239 NOTREACHED() << "Can't rollback a NoRollbackWorkItemList"; | 247 NOTREACHED() << "Can't rollback a NoRollbackWorkItemList"; |
| 240 } | 248 } |
| OLD | NEW |