| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/logging_installer.h" | 5 #include "chrome/installer/util/logging_installer.h" |
| 6 #include "chrome/installer/util/work_item_list.h" | 6 #include "chrome/installer/util/work_item_list.h" |
| 7 | 7 |
| 8 WorkItemList::~WorkItemList() { | 8 WorkItemList::~WorkItemList() { |
| 9 for (WorkItemIterator itr = list_.begin(); itr != list_.end(); ++itr) { | 9 for (WorkItemIterator itr = list_.begin(); itr != list_.end(); ++itr) { |
| 10 delete (*itr); | 10 delete (*itr); |
| 11 } | 11 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool WorkItemList::AddWorkItem(WorkItem* work_item) { | 58 bool WorkItemList::AddWorkItem(WorkItem* work_item) { |
| 59 if (status_ != ADD_ITEM) | 59 if (status_ != ADD_ITEM) |
| 60 return false; | 60 return false; |
| 61 | 61 |
| 62 list_.push_back(work_item); | 62 list_.push_back(work_item); |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool WorkItemList::AddCopyTreeWorkItem(std::wstring source_path, | 66 bool WorkItemList::AddCopyTreeWorkItem(const std::wstring& source_path, |
| 67 std::wstring dest_path, | 67 const std::wstring& dest_path, |
| 68 std::wstring temp_dir, | 68 const std::wstring& temp_dir, |
| 69 CopyOverWriteOption overwrite_option, | 69 CopyOverWriteOption overwrite_option, |
| 70 std::wstring alternative_path) { | 70 const std::wstring& alternative_path) { |
| 71 WorkItem* item = reinterpret_cast<WorkItem*>( | 71 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 72 WorkItem::CreateCopyTreeWorkItem(source_path, dest_path, temp_dir, | 72 WorkItem::CreateCopyTreeWorkItem(source_path, dest_path, temp_dir, |
| 73 overwrite_option, alternative_path)); | 73 overwrite_option, alternative_path)); |
| 74 return AddWorkItem(item); | 74 return AddWorkItem(item); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool WorkItemList::AddCreateDirWorkItem(std::wstring path) { | 77 bool WorkItemList::AddCreateDirWorkItem(const std::wstring& path) { |
| 78 WorkItem* item = reinterpret_cast<WorkItem*>( | 78 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 79 WorkItem::CreateCreateDirWorkItem(path)); | 79 WorkItem::CreateCreateDirWorkItem(path)); |
| 80 return AddWorkItem(item); | 80 return AddWorkItem(item); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool WorkItemList::AddCreateRegKeyWorkItem(HKEY predefined_root, | 83 bool WorkItemList::AddCreateRegKeyWorkItem(HKEY predefined_root, |
| 84 std::wstring path) { | 84 const std::wstring& path) { |
| 85 WorkItem* item = reinterpret_cast<WorkItem*>( | 85 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 86 WorkItem::CreateCreateRegKeyWorkItem(predefined_root, path)); | 86 WorkItem::CreateCreateRegKeyWorkItem(predefined_root, path)); |
| 87 return AddWorkItem(item); | 87 return AddWorkItem(item); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool WorkItemList::AddDeleteRegValueWorkItem(HKEY predefined_root, | 90 bool WorkItemList::AddDeleteRegValueWorkItem(HKEY predefined_root, |
| 91 std::wstring key_path, | 91 const std::wstring& key_path, |
| 92 std::wstring value_name, | 92 const std::wstring& value_name, |
| 93 bool is_str_type) { | 93 bool is_str_type) { |
| 94 WorkItem* item = reinterpret_cast<WorkItem*>( | 94 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 95 WorkItem::CreateDeleteRegValueWorkItem(predefined_root, key_path, | 95 WorkItem::CreateDeleteRegValueWorkItem(predefined_root, key_path, |
| 96 value_name, is_str_type)); | 96 value_name, is_str_type)); |
| 97 return AddWorkItem(item); | 97 return AddWorkItem(item); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool WorkItemList::AddDeleteTreeWorkItem(std::wstring root_path, | 100 bool WorkItemList::AddDeleteTreeWorkItem(const std::wstring& root_path, |
| 101 std::wstring key_path) { | 101 const std::wstring& key_path) { |
| 102 WorkItem* item = reinterpret_cast<WorkItem*>( | 102 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 103 WorkItem::CreateDeleteTreeWorkItem(root_path, key_path)); | 103 WorkItem::CreateDeleteTreeWorkItem(root_path, key_path)); |
| 104 return AddWorkItem(item); | 104 return AddWorkItem(item); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool WorkItemList::AddMoveTreeWorkItem(std::wstring source_path, | 107 bool WorkItemList::AddMoveTreeWorkItem(const std::wstring& source_path, |
| 108 std::wstring dest_path, | 108 const std::wstring& dest_path, |
| 109 std::wstring temp_dir) { | 109 const std::wstring& temp_dir) { |
| 110 WorkItem* item = reinterpret_cast<WorkItem*>( | 110 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 111 WorkItem::CreateMoveTreeWorkItem(source_path, dest_path, temp_dir)); | 111 WorkItem::CreateMoveTreeWorkItem(source_path, dest_path, temp_dir)); |
| 112 return AddWorkItem(item); | 112 return AddWorkItem(item); |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool WorkItemList::AddSetRegValueWorkItem(HKEY predefined_root, | 115 bool WorkItemList::AddSetRegValueWorkItem(HKEY predefined_root, |
| 116 std::wstring key_path, | 116 const std::wstring& key_path, |
| 117 std::wstring value_name, | 117 const std::wstring& value_name, |
| 118 std::wstring value_data, | 118 const std::wstring& value_data, |
| 119 bool overwrite) { | 119 bool overwrite) { |
| 120 WorkItem* item = reinterpret_cast<WorkItem*>( | 120 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 121 WorkItem::CreateSetRegValueWorkItem(predefined_root, key_path, value_name, | 121 WorkItem::CreateSetRegValueWorkItem(predefined_root, key_path, value_name, |
| 122 value_data, overwrite)); | 122 value_data, overwrite)); |
| 123 return AddWorkItem(item); | 123 return AddWorkItem(item); |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool WorkItemList::AddSetRegValueWorkItem(HKEY predefined_root, | 126 bool WorkItemList::AddSetRegValueWorkItem(HKEY predefined_root, |
| 127 std::wstring key_path, | 127 const std::wstring& key_path, |
| 128 std::wstring value_name, | 128 const std::wstring& value_name, |
| 129 DWORD value_data, | 129 DWORD value_data, |
| 130 bool overwrite) { | 130 bool overwrite) { |
| 131 WorkItem* item = reinterpret_cast<WorkItem*>( | 131 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 132 WorkItem::CreateSetRegValueWorkItem(predefined_root, key_path, value_name, | 132 WorkItem::CreateSetRegValueWorkItem(predefined_root, key_path, value_name, |
| 133 value_data, overwrite)); | 133 value_data, overwrite)); |
| 134 return AddWorkItem(item); | 134 return AddWorkItem(item); |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool WorkItemList::AddSelfRegWorkItem(const std::wstring& dll_path, | 137 bool WorkItemList::AddSelfRegWorkItem(const std::wstring& dll_path, |
| 138 bool do_register) { | 138 bool do_register) { |
| 139 WorkItem* item = reinterpret_cast<WorkItem*>( | 139 WorkItem* item = reinterpret_cast<WorkItem*>( |
| 140 WorkItem::CreateSelfRegWorkItem(dll_path, do_register)); | 140 WorkItem::CreateSelfRegWorkItem(dll_path, do_register)); |
| 141 return AddWorkItem(item); | 141 return AddWorkItem(item); |
| 142 } | 142 } |
| OLD | NEW |