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

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: Adding tests for cookie migration code; using SHORTCUT_REPLACE_EXISTING now. 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 shortcut.";
343 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, 343 if (!ShellUtil::RemoveShortcut(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 shortcut.";
346 } 346 }
347 // Also try to delete the alternate desktop shortcut. It is not sufficient 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 348 // to do so upon failure of the above call as ERROR_FILE_NOT_FOUND on
349 // delete is considered success. 349 // delete is considered success.
350 if (!ShellUtil::RemoveShortcut( 350 if (!ShellUtil::RemoveShortcutWithName(
gab 2013/04/29 19:06:36 If all shortcuts pointing to |target_exe| are dele
huangs 2013/04/30 03:04:16 Removed, noting that RemoveShortcut() continues to
351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, target_exe, install_level, 351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, install_level, target_exe,
352 &dist->GetAlternateApplicationName())) { 352 dist->GetAlternateApplicationName())) {
353 LOG(WARNING) << "Failed to delete alternate Desktop shortcut."; 353 LOG(WARNING) << "Failed to delete alternate Desktop shortcut.";
354 } 354 }
355 355
356 VLOG(1) << "Deleting Quick Launch shortcut."; 356 VLOG(1) << "Deleting Quick Launch shortcut.";
357 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, 357 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
358 dist, target_exe, install_level, NULL)) { 358 dist, install_level, target_exe)) {
359 LOG(WARNING) << "Failed to delete Quick Launch shortcut."; 359 LOG(WARNING) << "Failed to delete Quick Launch shortcut.";
360 } 360 }
361 361
362 VLOG(1) << "Deleting Start Menu shortcuts."; 362 VLOG(1) << "Deleting Start Menu shortcuts.";
363 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, 363 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist,
364 target_exe, install_level, NULL)) { 364 install_level, target_exe)) {
365 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; 365 LOG(WARNING) << "Failed to delete Start Menu shortcuts.";
366 } 366 }
367 367
368 // Although the shortcut removal calls above will unpin their shortcut if they 368 // Although the shortcut removal calls above will unpin their shortcut if they
369 // result in a deletion (i.e. shortcut existed and pointed to |target_exe|), 369 // result in a deletion (i.e. shortcut existed and pointed to |target_exe|),
370 // it is possible for shortcuts to remain pinned while their parent shortcut 370 // it is possible for shortcuts to remain pinned while their parent shortcut
371 // has been deleted or changed to point to another |target_exe|. Make sure all 371 // has been deleted or changed to point to another |target_exe|. Make sure all
372 // pinned-to-taskbar shortcuts that point to |target_exe| are unpinned. 372 // pinned-to-taskbar shortcuts that point to |target_exe| are unpinned.
373 ShellUtil::RemoveTaskbarShortcuts(target_exe.value()); 373 ShellUtil::RemoveTaskbarShortcuts(target_exe.value());
374 374
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 // deletion unconditionally. If they are not empty, the session manager 1414 // deletion unconditionally. If they are not empty, the session manager
1415 // will not delete them on reboot. 1415 // will not delete them on reboot.
1416 ScheduleParentAndGrandparentForDeletion(target_path); 1416 ScheduleParentAndGrandparentForDeletion(target_path);
1417 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == 1417 } else if (DeleteApplicationProductAndVendorDirectories(target_path) ==
1418 installer::DELETE_FAILED) { 1418 installer::DELETE_FAILED) {
1419 *uninstall_status = installer::UNINSTALL_FAILED; 1419 *uninstall_status = installer::UNINSTALL_FAILED;
1420 } 1420 }
1421 } 1421 }
1422 1422
1423 } // namespace installer 1423 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698