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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 shortcut."; |
gab
2013/04/30 19:20:33
nit: s/shortcut/shortcuts
huangs
2013/04/30 20:52:10
Done.
| |
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)) { |
grt (UTC plus 2)
2013/04/30 19:59:53
fix indentation for all of these
huangs
2013/04/30 20:52:10
Done.
| |
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 | |
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 } | |
355 | 347 |
356 VLOG(1) << "Deleting Quick Launch shortcut."; | 348 VLOG(1) << "Deleting Quick Launch shortcut."; |
gab
2013/04/30 19:20:33
nit: s/shortcut/shortcuts
huangs
2013/04/30 20:52:10
Done.
| |
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 shortcut."; |
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, |
gab
2013/04/30 19:20:33
Note to self (and huangs/calamity): this could eas
huangs
2013/04/30 20:52:10
Let's worry about this after my App Launcher thing
| |
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 // 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|), | 361 // 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 | 362 // 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 | 363 // 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. | 364 // pinned-to-taskbar shortcuts that point to |target_exe| are unpinned. |
373 ShellUtil::RemoveTaskbarShortcuts(target_exe.value()); | 365 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, |
366 dist, ShellUtil::CURRENT_USER, target_exe)) { | |
gab
2013/04/30 19:20:33
nit: indent
huangs
2013/04/30 20:52:10
Done.
| |
367 LOG_IF(WARNING, base::win::GetVersion() >= base::win::VERSION_WIN7) | |
368 << "Failed to unpin taskbar shortcuts at user-level."; | |
369 } | |
374 | 370 |
375 ShellUtil::RemoveStartScreenShortcuts(product.distribution(), | 371 ShellUtil::RemoveStartScreenShortcuts(product.distribution(), |
376 target_exe.value()); | 372 target_exe); |
377 } | 373 } |
378 | 374 |
379 bool ScheduleParentAndGrandparentForDeletion(const base::FilePath& path) { | 375 bool ScheduleParentAndGrandparentForDeletion(const base::FilePath& path) { |
380 base::FilePath parent_dir = path.DirName(); | 376 base::FilePath parent_dir = path.DirName(); |
381 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str()); | 377 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str()); |
382 if (!ret) { | 378 if (!ret) { |
383 LOG(ERROR) << "Failed to schedule parent dir for deletion: " | 379 LOG(ERROR) << "Failed to schedule parent dir for deletion: " |
384 << parent_dir.value(); | 380 << parent_dir.value(); |
385 } else { | 381 } else { |
386 base::FilePath grandparent_dir(parent_dir.DirName()); | 382 base::FilePath grandparent_dir(parent_dir.DirName()); |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1414 // deletion unconditionally. If they are not empty, the session manager | 1410 // deletion unconditionally. If they are not empty, the session manager |
1415 // will not delete them on reboot. | 1411 // will not delete them on reboot. |
1416 ScheduleParentAndGrandparentForDeletion(target_path); | 1412 ScheduleParentAndGrandparentForDeletion(target_path); |
1417 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == | 1413 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == |
1418 installer::DELETE_FAILED) { | 1414 installer::DELETE_FAILED) { |
1419 *uninstall_status = installer::UNINSTALL_FAILED; | 1415 *uninstall_status = installer::UNINSTALL_FAILED; |
1420 } | 1416 } |
1421 } | 1417 } |
1422 | 1418 |
1423 } // namespace installer | 1419 } // namespace installer |
OLD | NEW |