OLD | NEW |
---|---|
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 void DeleteShortcuts(const InstallerState& installer_state, | 388 void DeleteShortcuts(const InstallerState& installer_state, |
389 const Product& product, | 389 const Product& product, |
390 const base::FilePath& target_exe) { | 390 const base::FilePath& target_exe) { |
391 BrowserDistribution* dist = product.distribution(); | 391 BrowserDistribution* dist = product.distribution(); |
392 | 392 |
393 // The per-user shortcut for this user, if present on a system-level install, | 393 // The per-user shortcut for this user, if present on a system-level install, |
394 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). | 394 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). |
395 ShellUtil::ShellChange install_level = installer_state.system_install() ? | 395 ShellUtil::ShellChange install_level = installer_state.system_install() ? |
396 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | 396 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; |
397 | 397 |
398 VLOG(1) << "Deleting Desktop shortcuts."; | 398 // Delete and unpin all shortcuts that point to |target_exe| from all |
399 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, | 399 // ShellUtil::ShortcutLocations. |
400 install_level, target_exe)) { | 400 for (ShellUtil::ShortcutLocation location = SHORTCUT_LOCATION_START; |
401 LOG(WARNING) << "Failed to delete Desktop shortcuts."; | 401 location != SHORTCUT_LOCATION_END; ++location) { |
gab
2013/10/03 17:22:49
nit: indent +1 space.
| |
402 } | 402 if (!ShellUtil::RemoveShortcuts(location, dist, install_level, |
403 | 403 target_exe)) { |
404 VLOG(1) << "Deleting Quick Launch shortcuts."; | 404 LOG(WARNING) << "Failed to delete shortcuts with ShortcutLocation:" |
405 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, | 405 << location; |
406 dist, install_level, target_exe)) { | 406 } |
407 LOG(WARNING) << "Failed to delete Quick Launch shortcuts."; | |
408 } | |
409 | |
410 VLOG(1) << "Deleting Start Menu shortcuts."; | |
411 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, | |
412 install_level, target_exe)) { | |
413 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; | |
414 } | 407 } |
415 | 408 |
416 // Unpin all pinned-to-taskbar shortcuts that point to |chrome_exe|. | 409 // Unpin all pinned-to-taskbar shortcuts that point to |chrome_exe|. |
417 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, | 410 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, |
gab
2013/10/03 17:22:49
Gah; sucks we have to leave this one out.. this wh
| |
418 dist, ShellUtil::CURRENT_USER, target_exe)) { | 411 dist, ShellUtil::CURRENT_USER, target_exe)) { |
419 LOG(WARNING) << "Failed to unpin taskbar shortcuts at user-level."; | 412 LOG(WARNING) << "Failed to unpin taskbar shortcuts at user-level."; |
420 } | 413 } |
421 | |
422 // Delete the folder of secondary tiles from the start screen for |dist|. | |
423 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS, | |
424 dist, install_level, target_exe)) { | |
425 LOG(WARNING) << "Failed to delete start-screen shortcuts."; | |
426 } | |
427 } | 414 } |
428 | 415 |
429 bool ScheduleParentAndGrandparentForDeletion(const base::FilePath& path) { | 416 bool ScheduleParentAndGrandparentForDeletion(const base::FilePath& path) { |
430 base::FilePath parent_dir = path.DirName(); | 417 base::FilePath parent_dir = path.DirName(); |
431 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str()); | 418 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str()); |
432 if (!ret) { | 419 if (!ret) { |
433 LOG(ERROR) << "Failed to schedule parent dir for deletion: " | 420 LOG(ERROR) << "Failed to schedule parent dir for deletion: " |
434 << parent_dir.value(); | 421 << parent_dir.value(); |
435 } else { | 422 } else { |
436 base::FilePath grandparent_dir(parent_dir.DirName()); | 423 base::FilePath grandparent_dir(parent_dir.DirName()); |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1502 // deletion unconditionally. If they are not empty, the session manager | 1489 // deletion unconditionally. If they are not empty, the session manager |
1503 // will not delete them on reboot. | 1490 // will not delete them on reboot. |
1504 ScheduleParentAndGrandparentForDeletion(target_path); | 1491 ScheduleParentAndGrandparentForDeletion(target_path); |
1505 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == | 1492 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == |
1506 installer::DELETE_FAILED) { | 1493 installer::DELETE_FAILED) { |
1507 *uninstall_status = installer::UNINSTALL_FAILED; | 1494 *uninstall_status = installer::UNINSTALL_FAILED; |
1508 } | 1495 } |
1509 } | 1496 } |
1510 | 1497 |
1511 } // namespace installer | 1498 } // namespace installer |
OLD | NEW |