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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 if (kill) { | 324 if (kill) { |
325 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; | 325 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; |
326 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), | 326 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), |
327 content::RESULT_CODE_HUNG, NULL); | 327 content::RESULT_CODE_HUNG, NULL); |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 // Updates shortcuts to |old_target_exe| to target |new_target_exe| instead. If | |
332 // |require_args| is set, then only updates shortcuts with non-empty targets. | |
333 void RetargetShortcuts(const InstallerState& installer_state, | |
grt (UTC plus 2)
2013/09/04 03:50:36
since this only makes sense for a self-destruct, w
huangs
2013/09/04 14:48:39
Done. Also added blurb on function comment.
| |
334 const Product& product, | |
335 const base::FilePath& old_target_exe, | |
336 const base::FilePath& new_target_exe, | |
337 bool require_args) { | |
338 BrowserDistribution* dist = product.distribution(); | |
339 ShellUtil::ShellChange install_level = installer_state.system_install() ? | |
340 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | |
341 ShellUtil::ShortcutProperties updated_properties(install_level); | |
342 updated_properties.set_target(new_target_exe); | |
343 | |
344 VLOG(1) << "Retargeting Desktop shortcuts."; | |
345 if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, | |
346 install_level, old_target_exe, require_args, | |
347 updated_properties)) { | |
348 LOG(WARNING) << "Failed to retarget Desktop shortcuts."; | |
349 } | |
350 | |
351 VLOG(1) << "Retargeting Quick Launch shortcuts."; | |
352 if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, | |
353 dist, install_level, old_target_exe, | |
354 require_args, updated_properties)) { | |
355 LOG(WARNING) << "Failed to retarget Quick Launch shortcuts."; | |
356 } | |
357 | |
358 VLOG(1) << "Retargeting Start Menu shortcuts."; | |
359 if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, | |
360 install_level, old_target_exe, require_args, | |
361 updated_properties)) { | |
362 LOG(WARNING) << "Failed to retarget Start Menu shortcuts."; | |
363 } | |
364 | |
365 // Retarget pinned-to-taskbar shortcuts that point to |chrome_exe|. | |
366 if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, | |
367 dist, ShellUtil::CURRENT_USER, old_target_exe, | |
368 require_args, updated_properties)) { | |
369 LOG(WARNING) << "Failed to retarget taskbar shortcuts at user-level."; | |
370 } | |
371 | |
372 // Retarget the folder of secondary tiles from the start screen for |dist|. | |
373 if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS, | |
374 dist, install_level, old_target_exe, | |
375 require_args, updated_properties)) { | |
376 LOG(WARNING) << "Failed to retarget start-screen shortcuts."; | |
377 } | |
378 } | |
379 | |
331 // Deletes shortcuts at |install_level| from Start menu, Desktop, | 380 // Deletes shortcuts at |install_level| from Start menu, Desktop, |
332 // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). | 381 // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). |
333 // Only shortcuts pointing to |target_exe| will be removed. | 382 // Only shortcuts pointing to |target_exe| will be removed. |
334 void DeleteShortcuts(const InstallerState& installer_state, | 383 void DeleteShortcuts(const InstallerState& installer_state, |
335 const Product& product, | 384 const Product& product, |
336 const base::FilePath& target_exe) { | 385 const base::FilePath& target_exe) { |
337 BrowserDistribution* dist = product.distribution(); | 386 BrowserDistribution* dist = product.distribution(); |
338 | 387 |
339 // The per-user shortcut for this user, if present on a system-level install, | 388 // The per-user shortcut for this user, if present on a system-level install, |
340 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). | 389 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1129 ClearRlzProductState(); | 1178 ClearRlzProductState(); |
1130 // Delete the key that delegate_execute might make. | 1179 // Delete the key that delegate_execute might make. |
1131 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 1180 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
1132 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 1181 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
1133 chrome::kMetroRegistryPath); | 1182 chrome::kMetroRegistryPath); |
1134 } | 1183 } |
1135 | 1184 |
1136 auto_launch_util::DisableAllAutoStartFeatures( | 1185 auto_launch_util::DisableAllAutoStartFeatures( |
1137 ASCIIToUTF16(chrome::kInitialProfile)); | 1186 ASCIIToUTF16(chrome::kInitialProfile)); |
1138 | 1187 |
1188 // Self-destruct flow: removing user-level Chrome because system-level | |
1189 // Chrome exists. | |
1190 if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && | |
1191 !installer_state.system_install()) { | |
1192 const base::FilePath system_chrome_path( | |
1193 GetChromeInstallPath(true, browser_dist). | |
1194 Append(installer::kChromeExe)); | |
1195 VLOG(1) << "Retargeting user-generated Chrome shortcuts."; | |
1196 if (base::PathExists(system_chrome_path)) { | |
1197 // Retarget all user-generated shortcuts to user-level chrome.exe to | |
1198 // system-level chrome.exe. Heuristic: consider only shortcuts tha have | |
grt (UTC plus 2)
2013/09/04 03:50:36
tha -> that
huangs
2013/09/04 14:48:39
Done.
| |
1199 // non-empty args. Therefore the main user-level chrome.exe will not get | |
1200 // retarged, and will get deleted by DeleteShortcuts() below. | |
1201 RetargetShortcuts(installer_state, product, base::FilePath(chrome_exe), | |
1202 system_chrome_path, true); | |
1203 } else { | |
1204 VLOG(1) << "Retarget failed: system-level Chrome not found."; | |
1205 } | |
1206 } | |
1207 | |
1139 DeleteShortcuts(installer_state, product, base::FilePath(chrome_exe)); | 1208 DeleteShortcuts(installer_state, product, base::FilePath(chrome_exe)); |
1140 | 1209 |
1141 } else if (product.is_chrome_app_host()) { | 1210 } else if (product.is_chrome_app_host()) { |
1142 const base::FilePath app_host_exe( | 1211 const base::FilePath app_host_exe( |
1143 installer_state.target_path().Append(installer::kChromeAppHostExe)); | 1212 installer_state.target_path().Append(installer::kChromeAppHostExe)); |
1144 DeleteShortcuts(installer_state, product, app_host_exe); | 1213 DeleteShortcuts(installer_state, product, app_host_exe); |
1145 } | 1214 } |
1146 | 1215 |
1147 // Delete the registry keys (Uninstall key and Version key). | 1216 // Delete the registry keys (Uninstall key and Version key). |
1148 HKEY reg_root = installer_state.root_key(); | 1217 HKEY reg_root = installer_state.root_key(); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1427 // deletion unconditionally. If they are not empty, the session manager | 1496 // deletion unconditionally. If they are not empty, the session manager |
1428 // will not delete them on reboot. | 1497 // will not delete them on reboot. |
1429 ScheduleParentAndGrandparentForDeletion(target_path); | 1498 ScheduleParentAndGrandparentForDeletion(target_path); |
1430 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == | 1499 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == |
1431 installer::DELETE_FAILED) { | 1500 installer::DELETE_FAILED) { |
1432 *uninstall_status = installer::UNINSTALL_FAILED; | 1501 *uninstall_status = installer::UNINSTALL_FAILED; |
1433 } | 1502 } |
1434 } | 1503 } |
1435 | 1504 |
1436 } // namespace installer | 1505 } // namespace installer |
OLD | NEW |