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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 void RetargetUserShortcutsWithArgs(const InstallerState& installer_state, | 319 void RetargetUserShortcutsWithArgs(const InstallerState& installer_state, |
320 const Product& product, | 320 const Product& product, |
321 const base::FilePath& old_target_exe, | 321 const base::FilePath& old_target_exe, |
322 const base::FilePath& new_target_exe) { | 322 const base::FilePath& new_target_exe) { |
323 if (installer_state.system_install()) { | 323 if (installer_state.system_install()) { |
324 NOTREACHED(); | 324 NOTREACHED(); |
325 return; | 325 return; |
326 } | 326 } |
327 BrowserDistribution* dist = product.distribution(); | 327 BrowserDistribution* dist = product.distribution(); |
328 ShellUtil::ShellChange install_level = ShellUtil::CURRENT_USER; | 328 ShellUtil::ShellChange install_level = ShellUtil::CURRENT_USER; |
329 ShellUtil::ShortcutProperties updated_properties(install_level); | |
330 updated_properties.set_target(new_target_exe); | |
331 | 329 |
332 // Retarget all shortcuts that point to |old_target_exe| from all | 330 // Retarget all shortcuts that point to |old_target_exe| from all |
333 // ShellUtil::ShortcutLocations. | 331 // ShellUtil::ShortcutLocations. |
334 VLOG(1) << "Retargeting shortcuts."; | 332 VLOG(1) << "Retargeting shortcuts."; |
335 for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST; | 333 for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST; |
336 location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) { | 334 location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) { |
337 if (!ShellUtil::UpdateShortcutsWithArgs( | 335 if (!ShellUtil::RetargetShortcutsWithArgs( |
338 static_cast<ShellUtil::ShortcutLocation>(location), dist, | 336 static_cast<ShellUtil::ShortcutLocation>(location), dist, |
339 install_level, old_target_exe, updated_properties)) { | 337 install_level, old_target_exe, new_target_exe)) { |
340 LOG(WARNING) << "Failed to retarget shortcuts in ShortcutLocation: " | 338 LOG(WARNING) << "Failed to retarget shortcuts in ShortcutLocation: " |
341 << location; | 339 << location; |
342 } | 340 } |
343 } | 341 } |
344 } | 342 } |
345 | 343 |
346 // Deletes shortcuts at |install_level| from Start menu, Desktop, | 344 // Deletes shortcuts at |install_level| from Start menu, Desktop, |
347 // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). | 345 // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). |
348 // Only shortcuts pointing to |target_exe| will be removed. | 346 // Only shortcuts pointing to |target_exe| will be removed. |
349 void DeleteShortcuts(const InstallerState& installer_state, | 347 void DeleteShortcuts(const InstallerState& installer_state, |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 // If we need a reboot to continue, schedule the parent directories for | 1414 // If we need a reboot to continue, schedule the parent directories for |
1417 // deletion unconditionally. If they are not empty, the session manager | 1415 // deletion unconditionally. If they are not empty, the session manager |
1418 // will not delete them on reboot. | 1416 // will not delete them on reboot. |
1419 ScheduleParentAndGrandparentForDeletion(target_path); | 1417 ScheduleParentAndGrandparentForDeletion(target_path); |
1420 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { | 1418 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { |
1421 *uninstall_status = UNINSTALL_FAILED; | 1419 *uninstall_status = UNINSTALL_FAILED; |
1422 } | 1420 } |
1423 } | 1421 } |
1424 | 1422 |
1425 } // namespace installer | 1423 } // namespace installer |
OLD | NEW |