Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/installer/setup/uninstall.cc

Issue 1878313003: Convert //chrome/installer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert decompress.cc in mini_installer. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/setup/setup_util_unittest.cc ('k') | chrome/installer/util/beacons.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file defines the methods useful for uninstalling Chrome. 5 // This file defines the methods useful for uninstalling Chrome.
6 6
7 #include "chrome/installer/setup/uninstall.h" 7 #include "chrome/installer/setup/uninstall.h"
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 original_state.GetProductState(system_level, distribution->GetType()); 131 original_state.GetProductState(system_level, distribution->GetType());
132 DCHECK(product_state != NULL); 132 DCHECK(product_state != NULL);
133 ChannelInfo channel_info; 133 ChannelInfo channel_info;
134 134
135 // Remove product's flags from the channel value. 135 // Remove product's flags from the channel value.
136 channel_info.set_value(product_state->channel().value()); 136 channel_info.set_value(product_state->channel().value());
137 const bool modified = product.SetChannelFlags(false, &channel_info); 137 const bool modified = product.SetChannelFlags(false, &channel_info);
138 138
139 // Apply the new channel value to all other products and to the multi package. 139 // Apply the new channel value to all other products and to the multi package.
140 if (modified) { 140 if (modified) {
141 scoped_ptr<WorkItemList> 141 std::unique_ptr<WorkItemList> update_list(
142 update_list(WorkItem::CreateNoRollbackWorkItemList()); 142 WorkItem::CreateNoRollbackWorkItemList());
143 std::vector<BrowserDistribution::Type> dist_types; 143 std::vector<BrowserDistribution::Type> dist_types;
144 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { 144 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) {
145 BrowserDistribution::Type other_dist_type = 145 BrowserDistribution::Type other_dist_type =
146 static_cast<BrowserDistribution::Type>(i); 146 static_cast<BrowserDistribution::Type>(i);
147 if (distribution->GetType() != other_dist_type) 147 if (distribution->GetType() != other_dist_type)
148 dist_types.push_back(other_dist_type); 148 dist_types.push_back(other_dist_type);
149 } 149 }
150 AddChannelValueUpdateWorkItems(original_state, installer_state, 150 AddChannelValueUpdateWorkItems(original_state, installer_state,
151 channel_info, dist_types, 151 channel_info, dist_types,
152 update_list.get()); 152 update_list.get());
153 bool success = update_list->Do(); 153 bool success = update_list->Do();
154 LOG_IF(ERROR, !success) << "Failed updating channel values."; 154 LOG_IF(ERROR, !success) << "Failed updating channel values.";
155 } 155 }
156 } 156 }
157 157
158 // Processes uninstall WorkItems from install_worker in no-rollback-list. 158 // Processes uninstall WorkItems from install_worker in no-rollback-list.
159 void ProcessChromeWorkItems(const InstallerState& installer_state, 159 void ProcessChromeWorkItems(const InstallerState& installer_state,
160 const Product& product) { 160 const Product& product) {
161 scoped_ptr<WorkItemList> work_item_list( 161 std::unique_ptr<WorkItemList> work_item_list(
162 WorkItem::CreateNoRollbackWorkItemList()); 162 WorkItem::CreateNoRollbackWorkItemList());
163 AddOsUpgradeWorkItems(installer_state, base::FilePath(), Version(), product, 163 AddOsUpgradeWorkItems(installer_state, base::FilePath(), Version(), product,
164 work_item_list.get()); 164 work_item_list.get());
165 // Perform a best-effort cleanup of per-user keys. On system-level installs 165 // Perform a best-effort cleanup of per-user keys. On system-level installs
166 // this will only cleanup keys for the user running the uninstall but it was 166 // this will only cleanup keys for the user running the uninstall but it was
167 // considered that this was good enough (better than triggering Active Setup 167 // considered that this was good enough (better than triggering Active Setup
168 // for all users solely for this cleanup). 168 // for all users solely for this cleanup).
169 AddCleanupDeprecatedPerUserRegistrationsWorkItems(product, 169 AddCleanupDeprecatedPerUserRegistrationsWorkItems(product,
170 work_item_list.get()); 170 work_item_list.get());
171 if (!work_item_list->Do()) 171 if (!work_item_list->Do())
172 LOG(ERROR) << "Failed to process Chrome WorkItems."; 172 LOG(ERROR) << "Failed to process Chrome WorkItems.";
173 } 173 }
174 174
175 void ProcessIELowRightsPolicyWorkItems(const InstallerState& installer_state) { 175 void ProcessIELowRightsPolicyWorkItems(const InstallerState& installer_state) {
176 scoped_ptr<WorkItemList> work_items(WorkItem::CreateNoRollbackWorkItemList()); 176 std::unique_ptr<WorkItemList> work_items(
177 WorkItem::CreateNoRollbackWorkItemList());
177 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, work_items.get()); 178 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, work_items.get());
178 work_items->Do(); 179 work_items->Do();
179 RefreshElevationPolicy(); 180 RefreshElevationPolicy();
180 } 181 }
181 182
182 void ClearRlzProductState() { 183 void ClearRlzProductState() {
183 const rlz_lib::AccessPoint points[] = {rlz_lib::CHROME_OMNIBOX, 184 const rlz_lib::AccessPoint points[] = {rlz_lib::CHROME_OMNIBOX,
184 rlz_lib::CHROME_HOME_PAGE, 185 rlz_lib::CHROME_HOME_PAGE,
185 rlz_lib::CHROME_APP_LIST, 186 rlz_lib::CHROME_APP_LIST,
186 rlz_lib::NO_ACCESS_POINT}; 187 rlz_lib::NO_ACCESS_POINT};
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 base::string16 ext_association(ShellUtil::kRegClasses); 1066 base::string16 ext_association(ShellUtil::kRegClasses);
1066 ext_association.append(L"\\"); 1067 ext_association.append(L"\\");
1067 ext_association.append(L".crx"); 1068 ext_association.append(L".crx");
1068 InstallUtil::DeleteRegistryKey(roots[i], ext_association, 1069 InstallUtil::DeleteRegistryKey(roots[i], ext_association,
1069 WorkItem::kWow64Default); 1070 WorkItem::kWow64Default);
1070 } 1071 }
1071 } 1072 }
1072 1073
1073 void UninstallFirewallRules(BrowserDistribution* dist, 1074 void UninstallFirewallRules(BrowserDistribution* dist,
1074 const base::FilePath& chrome_exe) { 1075 const base::FilePath& chrome_exe) {
1075 scoped_ptr<FirewallManager> manager = 1076 std::unique_ptr<FirewallManager> manager =
1076 FirewallManager::Create(dist, chrome_exe); 1077 FirewallManager::Create(dist, chrome_exe);
1077 if (manager) 1078 if (manager)
1078 manager->RemoveFirewallRules(); 1079 manager->RemoveFirewallRules();
1079 } 1080 }
1080 1081
1081 InstallStatus UninstallProduct(const InstallationState& original_state, 1082 InstallStatus UninstallProduct(const InstallationState& original_state,
1082 const InstallerState& installer_state, 1083 const InstallerState& installer_state,
1083 const base::FilePath& setup_exe, 1084 const base::FilePath& setup_exe,
1084 const Product& product, 1085 const Product& product,
1085 bool remove_all, 1086 bool remove_all,
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } 1288 }
1288 1289
1289 // Unregister any dll servers that we may have registered for this 1290 // Unregister any dll servers that we may have registered for this
1290 // product. 1291 // product.
1291 if (product_state != NULL) { 1292 if (product_state != NULL) {
1292 std::vector<base::FilePath> com_dll_list; 1293 std::vector<base::FilePath> com_dll_list;
1293 product.AddComDllList(&com_dll_list); 1294 product.AddComDllList(&com_dll_list);
1294 base::FilePath dll_folder = installer_state.target_path().AppendASCII( 1295 base::FilePath dll_folder = installer_state.target_path().AppendASCII(
1295 product_state->version().GetString()); 1296 product_state->version().GetString());
1296 1297
1297 scoped_ptr<WorkItemList> unreg_work_item_list( 1298 std::unique_ptr<WorkItemList> unreg_work_item_list(
1298 WorkItem::CreateWorkItemList()); 1299 WorkItem::CreateWorkItemList());
1299 1300
1300 AddRegisterComDllWorkItems(dll_folder, 1301 AddRegisterComDllWorkItems(dll_folder,
1301 com_dll_list, 1302 com_dll_list,
1302 installer_state.system_install(), 1303 installer_state.system_install(),
1303 false, // Unregister 1304 false, // Unregister
1304 true, // May fail 1305 true, // May fail
1305 unreg_work_item_list.get()); 1306 unreg_work_item_list.get());
1306 unreg_work_item_list->Do(); 1307 unreg_work_item_list->Do();
1307 } 1308 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 // If we need a reboot to continue, schedule the parent directories for 1431 // If we need a reboot to continue, schedule the parent directories for
1431 // deletion unconditionally. If they are not empty, the session manager 1432 // deletion unconditionally. If they are not empty, the session manager
1432 // will not delete them on reboot. 1433 // will not delete them on reboot.
1433 ScheduleParentAndGrandparentForDeletion(target_path); 1434 ScheduleParentAndGrandparentForDeletion(target_path);
1434 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { 1435 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) {
1435 *uninstall_status = UNINSTALL_FAILED; 1436 *uninstall_status = UNINSTALL_FAILED;
1436 } 1437 }
1437 } 1438 }
1438 1439
1439 } // namespace installer 1440 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/setup_util_unittest.cc ('k') | chrome/installer/util/beacons.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698