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

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

Issue 11267023: Implementing --app-launcher install/uninstall flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing shortcut install (will do in different CL), but keeping some refactoring. Created 8 years, 1 month 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 | Annotate | Revision Log
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 } 250 }
251 251
252 if (kill) { 252 if (kill) {
253 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; 253 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing.";
254 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), 254 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(),
255 content::RESULT_CODE_HUNG, NULL); 255 content::RESULT_CODE_HUNG, NULL);
256 } 256 }
257 } 257 }
258 258
259 // This method deletes Chrome shortcut folder from Windows Start menu. It 259 // This method deletes shortcut from Windows Start menu, for the given
260 // checks system_uninstall to see if the shortcut is in all users start menu 260 // |install_level|. Either the standard desktop shortcut or the alternate
261 // or current user start menu. 261 // desktop shortcut are present. We don't know which one is present, so we
262 // We try to remove the standard desktop shortcut but if that fails we try 262 // delete both. Finally, we delete the quick lauch shortcut.
263 // to remove the alternate desktop shortcut. Only one of them should be 263 void DeleteShortcutsCommon(ShellUtil::ShellChange install_level,
264 // present in a given install but at this point we don't know which one. 264 BrowserDistribution* dist,
265 // We remove all start screen secondary tiles by removing the folder Windows
266 // uses to store this installation's tiles.
267 void DeleteChromeShortcuts(const InstallerState& installer_state,
268 const Product& product,
269 const string16& chrome_exe) { 265 const string16& chrome_exe) {
270 if (!product.is_chrome()) {
271 VLOG(1) << __FUNCTION__ " called for non-CHROME distribution";
272 return;
273 }
274
275 BrowserDistribution* dist = product.distribution();
276
277 // The per-user shortcut for this user, if present on a system-level install,
278 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks().
279 ShellUtil::ShellChange install_level = installer_state.system_install() ?
280 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER;
281
282 VLOG(1) << "Deleting Desktop shortcut."; 266 VLOG(1) << "Deleting Desktop shortcut.";
283 if (!ShellUtil::RemoveChromeShortcut( 267 if (!ShellUtil::RemoveChromeShortcut(
284 ShellUtil::SHORTCUT_DESKTOP, dist, chrome_exe, install_level, NULL)) { 268 ShellUtil::SHORTCUT_DESKTOP, dist, chrome_exe, install_level, NULL)) {
285 LOG(WARNING) << "Failed to delete Desktop shortcut."; 269 LOG(WARNING) << "Failed to delete Desktop shortcut.";
286 } 270 }
287 // Also try to delete the alternate desktop shortcut. It is not sufficient 271 // Also try to delete the alternate desktop shortcut. It is not sufficient
288 // to do so upon failure of the above call as ERROR_FILE_NOT_FOUND on 272 // to do so upon failure of the above call as ERROR_FILE_NOT_FOUND on
289 // delete is considered success. 273 // delete is considered success.
290 if (!ShellUtil::RemoveChromeShortcut( 274 if (!ShellUtil::RemoveChromeShortcut(
291 ShellUtil::SHORTCUT_DESKTOP, dist, chrome_exe, install_level, 275 ShellUtil::SHORTCUT_DESKTOP, dist, chrome_exe, install_level,
292 &dist->GetAlternateApplicationName())) { 276 &dist->GetAlternateApplicationName())) {
293 LOG(WARNING) << "Failed to delete alternate Desktop shortcut."; 277 LOG(WARNING) << "Failed to delete alternate Desktop shortcut.";
294 } 278 }
295 279
296 VLOG(1) << "Deleting Quick Launch shortcut."; 280 VLOG(1) << "Deleting Quick Launch shortcut.";
297 if (!ShellUtil::RemoveChromeShortcut( 281 if (!ShellUtil::RemoveChromeShortcut(
298 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, chrome_exe, install_level, 282 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, chrome_exe, install_level,
299 NULL)) { 283 NULL)) {
300 LOG(WARNING) << "Failed to delete Quick Launch shortcut."; 284 LOG(WARNING) << "Failed to delete Quick Launch shortcut.";
301 } 285 }
286 }
287
288 // This method deletes Chrome shortcut folder from Windows Start menu. It
289 // checks system_uninstall to see if the shortcut is in all users start menu
290 // or current user start menu. After deleting individual shortcuts, we then
291 // remove all start screen secondary tiles by removing the folder Windows
292 // uses to store this installation's tiles.
293 void DeleteChromeShortcuts(const InstallerState& installer_state,
294 const Product& product,
295 const string16& chrome_exe) {
296 if (!product.is_chrome()) {
297 VLOG(1) << __FUNCTION__ " called for non-CHROME distribution";
298 return;
299 }
300
301 // The per-user shortcut for this user, if present on a system-level install,
302 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks().
303 ShellUtil::ShellChange install_level = installer_state.system_install() ?
304 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER;
305
306 BrowserDistribution* dist = product.distribution();
307 DeleteShortcutsCommon(install_level, dist, chrome_exe);
302 308
303 VLOG(1) << "Deleting Start Menu shortcuts."; 309 VLOG(1) << "Deleting Start Menu shortcuts.";
304 if (!ShellUtil::RemoveChromeShortcut( 310 if (!ShellUtil::RemoveChromeShortcut(
305 ShellUtil::SHORTCUT_START_MENU, dist, chrome_exe, install_level, 311 ShellUtil::SHORTCUT_START_MENU, dist, chrome_exe, install_level,
306 NULL)) { 312 NULL)) {
307 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; 313 LOG(WARNING) << "Failed to delete Start Menu shortcuts.";
308 } 314 }
309 315
310 ShellUtil::RemoveChromeStartScreenShortcuts(product.distribution(), 316 ShellUtil::RemoveChromeStartScreenShortcuts(product.distribution(),
311 chrome_exe); 317 chrome_exe);
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 1274
1269 // Try and delete the preserved local state once the post-install 1275 // Try and delete the preserved local state once the post-install
1270 // operations are complete. 1276 // operations are complete.
1271 if (!backup_state_file.empty()) 1277 if (!backup_state_file.empty())
1272 file_util::Delete(backup_state_file, false); 1278 file_util::Delete(backup_state_file, false);
1273 1279
1274 return ret; 1280 return ret;
1275 } 1281 }
1276 1282
1277 } // namespace installer 1283 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698