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

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

Issue 13864015: Move app launcher and chrome apps shortcut strings into the installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_app_id_fix
Patch Set: fix linux unit tests Created 7 years, 2 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 NOTREACHED(); 340 NOTREACHED();
341 return; 341 return;
342 } 342 }
343 BrowserDistribution* dist = product.distribution(); 343 BrowserDistribution* dist = product.distribution();
344 ShellUtil::ShellChange install_level = ShellUtil::CURRENT_USER; 344 ShellUtil::ShellChange install_level = ShellUtil::CURRENT_USER;
345 ShellUtil::ShortcutProperties updated_properties(install_level); 345 ShellUtil::ShortcutProperties updated_properties(install_level);
346 updated_properties.set_target(new_target_exe); 346 updated_properties.set_target(new_target_exe);
347 347
348 // TODO(huangs): Make this data-driven, along with DeleteShortcuts(). 348 // TODO(huangs): Make this data-driven, along with DeleteShortcuts().
349 VLOG(1) << "Retargeting Desktop shortcuts."; 349 VLOG(1) << "Retargeting Desktop shortcuts.";
350 if (!ShellUtil::UpdateShortcutsWithArgs( 350 if (!ShellUtil::UpdateShortcutsWithArgs(
gab 2013/10/03 17:22:49 Use the same looping logic here to capture all app
calamity 2013/10/14 02:24:25 Done.
351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, install_level, 351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, install_level,
352 old_target_exe, updated_properties)) { 352 old_target_exe, updated_properties)) {
353 LOG(WARNING) << "Failed to retarget Desktop shortcuts."; 353 LOG(WARNING) << "Failed to retarget Desktop shortcuts.";
354 } 354 }
355 355
356 VLOG(1) << "Retargeting Quick Launch shortcuts."; 356 VLOG(1) << "Retargeting Quick Launch shortcuts.";
357 if (!ShellUtil::UpdateShortcutsWithArgs( 357 if (!ShellUtil::UpdateShortcutsWithArgs(
358 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, install_level, 358 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, install_level,
359 old_target_exe, updated_properties)) { 359 old_target_exe, updated_properties)) {
360 LOG(WARNING) << "Failed to retarget Quick Launch shortcuts."; 360 LOG(WARNING) << "Failed to retarget Quick Launch shortcuts.";
(...skipping 27 matching lines...) Expand all
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) {
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,
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); 418 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir);
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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 // deletion unconditionally. If they are not empty, the session manager 1492 // deletion unconditionally. If they are not empty, the session manager
1506 // will not delete them on reboot. 1493 // will not delete them on reboot.
1507 ScheduleParentAndGrandparentForDeletion(target_path); 1494 ScheduleParentAndGrandparentForDeletion(target_path);
1508 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == 1495 } else if (DeleteApplicationProductAndVendorDirectories(target_path) ==
1509 installer::DELETE_FAILED) { 1496 installer::DELETE_FAILED) {
1510 *uninstall_status = installer::UNINSTALL_FAILED; 1497 *uninstall_status = installer::UNINSTALL_FAILED;
1511 } 1498 }
1512 } 1499 }
1513 1500
1514 } // namespace installer 1501 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698