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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 if (kill) { | 319 if (kill) { |
320 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; | 320 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; |
321 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), | 321 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), |
322 content::RESULT_CODE_HUNG, NULL); | 322 content::RESULT_CODE_HUNG, NULL); |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 // Deletes shortcuts at |install_level| from Start menu, Desktop, | 326 // Deletes shortcuts at |install_level| from Start menu, Desktop, |
327 // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). | 327 // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). |
328 // Only shortcuts pointing to |target| will be removed. | 328 // Only shortcuts pointing to |target_exe| will be removed. |
329 void DeleteShortcuts(const InstallerState& installer_state, | 329 void DeleteShortcuts(const InstallerState& installer_state, |
330 const Product& product, | 330 const Product& product, |
331 const string16& target_exe) { | 331 const FilePath& target_exe) { |
332 BrowserDistribution* dist = product.distribution(); | 332 BrowserDistribution* dist = product.distribution(); |
333 | 333 |
334 // The per-user shortcut for this user, if present on a system-level install, | 334 // The per-user shortcut for this user, if present on a system-level install, |
335 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). | 335 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). |
336 ShellUtil::ShellChange install_level = installer_state.system_install() ? | 336 ShellUtil::ShellChange install_level = installer_state.system_install() ? |
337 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | 337 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; |
338 | 338 |
339 VLOG(1) << "Deleting Desktop shortcut."; | 339 VLOG(1) << "Deleting Desktop shortcut."; |
340 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, | 340 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, |
341 target_exe, install_level, NULL)) { | 341 target_exe, install_level, NULL)) { |
(...skipping 18 matching lines...) Expand all Loading... |
360 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, | 360 if (!ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, |
361 target_exe, install_level, NULL)) { | 361 target_exe, install_level, NULL)) { |
362 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; | 362 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; |
363 } | 363 } |
364 | 364 |
365 // Although the shortcut removal calls above will unpin their shortcut if they | 365 // Although the shortcut removal calls above will unpin their shortcut if they |
366 // result in a deletion (i.e. shortcut existed and pointed to |target_exe|), | 366 // result in a deletion (i.e. shortcut existed and pointed to |target_exe|), |
367 // it is possible for shortcuts to remain pinned while their parent shortcut | 367 // it is possible for shortcuts to remain pinned while their parent shortcut |
368 // has been deleted or changed to point to another |target_exe|. Make sure all | 368 // has been deleted or changed to point to another |target_exe|. Make sure all |
369 // pinned-to-taskbar shortcuts that point to |target_exe| are unpinned. | 369 // pinned-to-taskbar shortcuts that point to |target_exe| are unpinned. |
370 ShellUtil::RemoveTaskbarShortcuts(target_exe); | 370 ShellUtil::RemoveTaskbarShortcuts(target_exe.value()); |
371 | 371 |
372 ShellUtil::RemoveStartScreenShortcuts(product.distribution(), | 372 ShellUtil::RemoveStartScreenShortcuts(product.distribution(), |
373 target_exe); | 373 target_exe.value()); |
374 } | 374 } |
375 | 375 |
376 bool ScheduleParentAndGrandparentForDeletion(const FilePath& path) { | 376 bool ScheduleParentAndGrandparentForDeletion(const FilePath& path) { |
377 FilePath parent_dir = path.DirName(); | 377 FilePath parent_dir = path.DirName(); |
378 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str()); | 378 bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str()); |
379 if (!ret) { | 379 if (!ret) { |
380 LOG(ERROR) << "Failed to schedule parent dir for deletion: " | 380 LOG(ERROR) << "Failed to schedule parent dir for deletion: " |
381 << parent_dir.value(); | 381 << parent_dir.value(); |
382 } else { | 382 } else { |
383 FilePath grandparent_dir(parent_dir.DirName()); | 383 FilePath grandparent_dir(parent_dir.DirName()); |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 ClearRlzProductState(); | 1121 ClearRlzProductState(); |
1122 // Delete the key that delegate_execute might make. | 1122 // Delete the key that delegate_execute might make. |
1123 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 1123 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
1124 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 1124 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
1125 chrome::kMetroRegistryPath); | 1125 chrome::kMetroRegistryPath); |
1126 } | 1126 } |
1127 | 1127 |
1128 auto_launch_util::DisableAllAutoStartFeatures( | 1128 auto_launch_util::DisableAllAutoStartFeatures( |
1129 ASCIIToUTF16(chrome::kInitialProfile)); | 1129 ASCIIToUTF16(chrome::kInitialProfile)); |
1130 | 1130 |
1131 DeleteShortcuts(installer_state, product, chrome_exe); | 1131 DeleteShortcuts(installer_state, product, FilePath(chrome_exe)); |
1132 | 1132 |
1133 } else if (product.is_chrome_app_host()) { | 1133 } else if (product.is_chrome_app_host()) { |
1134 // TODO(huangs): Remove this check once we have system-level App Host. | 1134 // TODO(huangs): Remove this check once we have system-level App Host. |
1135 DCHECK(!installer_state.system_install()); | 1135 DCHECK(!installer_state.system_install()); |
1136 const string16 app_host_exe( | 1136 const FilePath app_host_exe( |
1137 installer_state.target_path().Append(installer::kChromeAppHostExe) | 1137 installer_state.target_path().Append(installer::kChromeAppHostExe)); |
1138 .value()); | |
1139 DeleteShortcuts(installer_state, product, app_host_exe); | 1138 DeleteShortcuts(installer_state, product, app_host_exe); |
1140 } | 1139 } |
1141 | 1140 |
1142 // Delete the registry keys (Uninstall key and Version key). | 1141 // Delete the registry keys (Uninstall key and Version key). |
1143 HKEY reg_root = installer_state.root_key(); | 1142 HKEY reg_root = installer_state.root_key(); |
1144 | 1143 |
1145 // Note that we must retrieve the distribution-specific data before deleting | 1144 // Note that we must retrieve the distribution-specific data before deleting |
1146 // product.GetVersionKey(). | 1145 // product.GetVersionKey(). |
1147 string16 distribution_data(browser_dist->GetDistributionData(reg_root)); | 1146 string16 distribution_data(browser_dist->GetDistributionData(reg_root)); |
1148 | 1147 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 // deletion unconditionally. If they are not empty, the session manager | 1408 // deletion unconditionally. If they are not empty, the session manager |
1410 // will not delete them on reboot. | 1409 // will not delete them on reboot. |
1411 ScheduleParentAndGrandparentForDeletion(target_path); | 1410 ScheduleParentAndGrandparentForDeletion(target_path); |
1412 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == | 1411 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == |
1413 installer::DELETE_FAILED) { | 1412 installer::DELETE_FAILED) { |
1414 *uninstall_status = installer::UNINSTALL_FAILED; | 1413 *uninstall_status = installer::UNINSTALL_FAILED; |
1415 } | 1414 } |
1416 } | 1415 } |
1417 | 1416 |
1418 } // namespace installer | 1417 } // namespace installer |
OLD | NEW |