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

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

Issue 14287008: Refactoring installer shortcut deletion; adding dedicated shortcut update feature. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverting ShellUtil unittest changes; bit more fixing. Created 7 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 10
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 void DeleteShortcuts(const InstallerState& installer_state, 332 void DeleteShortcuts(const InstallerState& installer_state,
333 const Product& product, 333 const Product& product,
334 const base::FilePath& target_exe) { 334 const base::FilePath& target_exe) {
335 BrowserDistribution* dist = product.distribution(); 335 BrowserDistribution* dist = product.distribution();
336 336
337 // The per-user shortcut for this user, if present on a system-level install, 337 // The per-user shortcut for this user, if present on a system-level install,
338 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). 338 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks().
339 ShellUtil::ShellChange install_level = installer_state.system_install() ? 339 ShellUtil::ShellChange install_level = installer_state.system_install() ?
340 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; 340 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER;
341 341
342 VLOG(1) << "Deleting Desktop shortcut."; 342 VLOG(1) << "Deleting Desktop shortcuts.";
343 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, 343 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist,
344 target_exe, install_level, NULL)) { 344 install_level, target_exe)) {
345 LOG(WARNING) << "Failed to delete Desktop shortcut."; 345 LOG(WARNING) << "Failed to delete Desktop shortcuts.";
346 }
347 // Also try to delete the alternate desktop shortcut. It is not sufficient
348 // to do so upon failure of the above call as ERROR_FILE_NOT_FOUND on
349 // delete is considered success.
350 if (!ShellUtil::RemoveShortcut(
351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, target_exe, install_level,
352 &dist->GetAlternateApplicationName())) {
353 LOG(WARNING) << "Failed to delete alternate Desktop shortcut.";
354 } 346 }
355 347
356 VLOG(1) << "Deleting Quick Launch shortcut."; 348 VLOG(1) << "Deleting Quick Launch shortcuts.";
357 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, 349 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
358 dist, target_exe, install_level, NULL)) { 350 dist, install_level, target_exe)) {
359 LOG(WARNING) << "Failed to delete Quick Launch shortcut."; 351 LOG(WARNING) << "Failed to delete Quick Launch shortcuts.";
360 } 352 }
361 353
362 VLOG(1) << "Deleting Start Menu shortcuts."; 354 VLOG(1) << "Deleting Start Menu shortcuts.";
363 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, 355 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist,
364 target_exe, install_level, NULL)) { 356 install_level, target_exe)) {
365 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; 357 LOG(WARNING) << "Failed to delete Start Menu shortcuts.";
366 } 358 }
367 359
368 // Although the shortcut removal calls above will unpin their shortcut if they 360 // Unpin all pinned-to-taskbar shortcuts that point to |chrome_exe|.
369 // result in a deletion (i.e. shortcut existed and pointed to |target_exe|), 361 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS,
370 // it is possible for shortcuts to remain pinned while their parent shortcut 362 dist, ShellUtil::CURRENT_USER, target_exe)) {
371 // has been deleted or changed to point to another |target_exe|. Make sure all 363 LOG(WARNING) << "Failed to unpin taskbar shortcuts at user-level.";
372 // pinned-to-taskbar shortcuts that point to |target_exe| are unpinned. 364 }
373 ShellUtil::RemoveTaskbarShortcuts(target_exe.value());
374 365
375 ShellUtil::RemoveStartScreenShortcuts(product.distribution(), 366 // Delete the folder of secondary tiles from the start screen for |dist|.
376 target_exe.value()); 367 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS,
368 dist, install_level, target_exe)) {
369 LOG(WARNING) << "Failed to delete start-screen shortcuts.";
370 }
377 } 371 }
378 372
379 bool ScheduleParentAndGrandparentForDeletion(const base::FilePath& path) { 373 bool ScheduleParentAndGrandparentForDeletion(const base::FilePath& path) {
380 base::FilePath parent_dir = path.DirName(); 374 base::FilePath parent_dir = path.DirName();
381 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str()); 375 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str());
382 if (!ret) { 376 if (!ret) {
383 LOG(ERROR) << "Failed to schedule parent dir for deletion: " 377 LOG(ERROR) << "Failed to schedule parent dir for deletion: "
384 << parent_dir.value(); 378 << parent_dir.value();
385 } else { 379 } else {
386 base::FilePath grandparent_dir(parent_dir.DirName()); 380 base::FilePath grandparent_dir(parent_dir.DirName());
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 // deletion unconditionally. If they are not empty, the session manager 1408 // deletion unconditionally. If they are not empty, the session manager
1415 // will not delete them on reboot. 1409 // will not delete them on reboot.
1416 ScheduleParentAndGrandparentForDeletion(target_path); 1410 ScheduleParentAndGrandparentForDeletion(target_path);
1417 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == 1411 } else if (DeleteApplicationProductAndVendorDirectories(target_path) ==
1418 installer::DELETE_FAILED) { 1412 installer::DELETE_FAILED) {
1419 *uninstall_status = installer::UNINSTALL_FAILED; 1413 *uninstall_status = installer::UNINSTALL_FAILED;
1420 } 1414 }
1421 } 1415 }
1422 1416
1423 } // namespace installer 1417 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698