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

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

Issue 1882923003: Add best-effort/allow rollback flags on WorkItem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_list_tests
Patch Set: fix build error Created 4 years, 7 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
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 std::unique_ptr<WorkItemList> update_list( 141 std::unique_ptr<WorkItemList> update_list(WorkItem::CreateWorkItemList());
142 WorkItem::CreateNoRollbackWorkItemList()); 142 update_list->set_log_message("Channel Value Update");
143 update_list->set_best_effort(true);
144 update_list->set_rollback_enabled(false);
143 std::vector<BrowserDistribution::Type> dist_types; 145 std::vector<BrowserDistribution::Type> dist_types;
144 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { 146 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) {
145 BrowserDistribution::Type other_dist_type = 147 BrowserDistribution::Type other_dist_type =
146 static_cast<BrowserDistribution::Type>(i); 148 static_cast<BrowserDistribution::Type>(i);
147 if (distribution->GetType() != other_dist_type) 149 if (distribution->GetType() != other_dist_type)
148 dist_types.push_back(other_dist_type); 150 dist_types.push_back(other_dist_type);
149 } 151 }
150 AddChannelValueUpdateWorkItems(original_state, installer_state, 152 AddChannelValueUpdateWorkItems(original_state, installer_state,
151 channel_info, dist_types, 153 channel_info, dist_types,
152 update_list.get()); 154 update_list.get());
153 bool success = update_list->Do(); 155 update_list->Do();
154 LOG_IF(ERROR, !success) << "Failed updating channel values.";
155 } 156 }
156 } 157 }
157 158
158 // Processes uninstall WorkItems from install_worker in no-rollback-list. 159 // Processes uninstall WorkItems from install_worker in no-rollback-list.
159 void ProcessChromeWorkItems(const InstallerState& installer_state, 160 void ProcessChromeWorkItems(const InstallerState& installer_state,
160 const Product& product) { 161 const Product& product) {
161 std::unique_ptr<WorkItemList> work_item_list( 162 std::unique_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList());
162 WorkItem::CreateNoRollbackWorkItemList()); 163 work_item_list->set_log_message(
164 "Cleanup OS upgrade command and deprecated per-user registrations");
165 work_item_list->set_best_effort(true);
166 work_item_list->set_rollback_enabled(false);
163 AddOsUpgradeWorkItems(installer_state, base::FilePath(), Version(), product, 167 AddOsUpgradeWorkItems(installer_state, base::FilePath(), Version(), product,
164 work_item_list.get()); 168 work_item_list.get());
165 // Perform a best-effort cleanup of per-user keys. On system-level installs 169 // 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 170 // 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 171 // considered that this was good enough (better than triggering Active Setup
168 // for all users solely for this cleanup). 172 // for all users solely for this cleanup).
169 AddCleanupDeprecatedPerUserRegistrationsWorkItems(product, 173 AddCleanupDeprecatedPerUserRegistrationsWorkItems(product,
170 work_item_list.get()); 174 work_item_list.get());
171 if (!work_item_list->Do()) 175 work_item_list->Do();
172 LOG(ERROR) << "Failed to process Chrome WorkItems.";
173 } 176 }
174 177
175 void ProcessIELowRightsPolicyWorkItems(const InstallerState& installer_state) { 178 void ProcessIELowRightsPolicyWorkItems(const InstallerState& installer_state) {
176 std::unique_ptr<WorkItemList> work_items( 179 std::unique_ptr<WorkItemList> work_items(WorkItem::CreateWorkItemList());
177 WorkItem::CreateNoRollbackWorkItemList()); 180 work_items->set_log_message("Delete old IE low rights policy");
181 work_items->set_best_effort(true);
182 work_items->set_rollback_enabled(false);
178 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, work_items.get()); 183 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, work_items.get());
179 work_items->Do(); 184 work_items->Do();
180 RefreshElevationPolicy(); 185 RefreshElevationPolicy();
181 } 186 }
182 187
183 void ClearRlzProductState() { 188 void ClearRlzProductState() {
184 const rlz_lib::AccessPoint points[] = {rlz_lib::CHROME_OMNIBOX, 189 const rlz_lib::AccessPoint points[] = {rlz_lib::CHROME_OMNIBOX,
185 rlz_lib::CHROME_HOME_PAGE, 190 rlz_lib::CHROME_HOME_PAGE,
186 rlz_lib::CHROME_APP_LIST, 191 rlz_lib::CHROME_APP_LIST,
187 rlz_lib::NO_ACCESS_POINT}; 192 rlz_lib::NO_ACCESS_POINT};
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 // If we need a reboot to continue, schedule the parent directories for 1436 // If we need a reboot to continue, schedule the parent directories for
1432 // deletion unconditionally. If they are not empty, the session manager 1437 // deletion unconditionally. If they are not empty, the session manager
1433 // will not delete them on reboot. 1438 // will not delete them on reboot.
1434 ScheduleParentAndGrandparentForDeletion(target_path); 1439 ScheduleParentAndGrandparentForDeletion(target_path);
1435 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { 1440 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) {
1436 *uninstall_status = UNINSTALL_FAILED; 1441 *uninstall_status = UNINSTALL_FAILED;
1437 } 1442 }
1438 } 1443 }
1439 1444
1440 } // namespace installer 1445 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698