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

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

Issue 660168: Disable registering, unregistering, and setting default browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 332 }
333 333
334 return installer_util::UNINSTALL_CONFIRMED; 334 return installer_util::UNINSTALL_CONFIRMED;
335 } 335 }
336 } // namespace 336 } // namespace
337 337
338 338
339 bool installer_setup::DeleteChromeRegistrationKeys(HKEY root, 339 bool installer_setup::DeleteChromeRegistrationKeys(HKEY root,
340 const std::wstring& browser_entry_suffix, 340 const std::wstring& browser_entry_suffix,
341 installer_util::InstallStatus& exit_code) { 341 installer_util::InstallStatus& exit_code) {
342 if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) {
343 // We should have never set those keys.
344 return true;
345 }
346
342 RegKey key(root, L"", KEY_ALL_ACCESS); 347 RegKey key(root, L"", KEY_ALL_ACCESS);
343 348
344 // Delete Software\Classes\ChromeHTML, 349 // Delete Software\Classes\ChromeHTML,
345 std::wstring html_prog_id(ShellUtil::kRegClasses); 350 std::wstring html_prog_id(ShellUtil::kRegClasses);
346 file_util::AppendToPath(&html_prog_id, ShellUtil::kChromeHTMLProgId); 351 file_util::AppendToPath(&html_prog_id, ShellUtil::kChromeHTMLProgId);
347 html_prog_id.append(browser_entry_suffix); 352 html_prog_id.append(browser_entry_suffix);
348 DeleteRegistryKey(key, html_prog_id); 353 DeleteRegistryKey(key, html_prog_id);
349 354
350 // Delete Software\Clients\StartMenuInternet\Chromium 355 // Delete Software\Clients\StartMenuInternet\Chromium
351 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 356 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 507
503 // For user level install also we end up creating some keys in HKLM if user 508 // For user level install also we end up creating some keys in HKLM if user
504 // sets Chrome as default browser. So delete those as well (needs admin). 509 // sets Chrome as default browser. So delete those as well (needs admin).
505 if (remove_all && !system_uninstall && 510 if (remove_all && !system_uninstall &&
506 (!suffix.empty() || CurrentUserHasDefaultBrowser(system_uninstall))) 511 (!suffix.empty() || CurrentUserHasDefaultBrowser(system_uninstall)))
507 DeleteChromeRegistrationKeys(HKEY_LOCAL_MACHINE, suffix, ret); 512 DeleteChromeRegistrationKeys(HKEY_LOCAL_MACHINE, suffix, ret);
508 513
509 // Delete shared registry keys as well (these require admin rights) if 514 // Delete shared registry keys as well (these require admin rights) if
510 // remove_all option is specified. 515 // remove_all option is specified.
511 if (remove_all) { 516 if (remove_all) {
512 // Delete media player registry key that exists only in HKLM. 517 if (!InstallUtil::IsChromeSxSProcess()) {
513 RegKey hklm_key(HKEY_LOCAL_MACHINE, L"", KEY_ALL_ACCESS); 518 // Delete media player registry key that exists only in HKLM.
514 std::wstring reg_path(installer::kMediaPlayerRegPath); 519 // We don't delete this key in SxS uninstall.
515 file_util::AppendToPath(&reg_path, installer_util::kChromeExe); 520 RegKey hklm_key(HKEY_LOCAL_MACHINE, L"", KEY_ALL_ACCESS);
516 DeleteRegistryKey(hklm_key, reg_path); 521 std::wstring reg_path(installer::kMediaPlayerRegPath);
517 hklm_key.Close(); 522 file_util::AppendToPath(&reg_path, installer_util::kChromeExe);
523 DeleteRegistryKey(hklm_key, reg_path);
524 hklm_key.Close();
525 }
518 526
519 if (installed_version.get()) { 527 if (installed_version.get()) {
520 // Unregister any dll servers that we may have registered. 528 // Unregister any dll servers that we may have registered.
521 std::wstring dll_path(installer::GetChromeInstallPath(system_uninstall)); 529 std::wstring dll_path(installer::GetChromeInstallPath(system_uninstall));
522 file_util::AppendToPath(&dll_path, installed_version->GetString()); 530 file_util::AppendToPath(&dll_path, installed_version->GetString());
523 531
524 scoped_ptr<WorkItemList> dll_list(WorkItem::CreateWorkItemList()); 532 scoped_ptr<WorkItemList> dll_list(WorkItem::CreateWorkItemList());
525 if (InstallUtil::BuildDLLRegistrationList(dll_path, kDllsToRegister, 533 if (InstallUtil::BuildDLLRegistrationList(dll_path, kDllsToRegister,
526 kNumDllsToRegister, false, 534 kNumDllsToRegister, false,
527 dll_list.get())) { 535 dll_list.get())) {
(...skipping 26 matching lines...) Expand all
554 distribution_data); 562 distribution_data);
555 } 563 }
556 564
557 // Try and delete the preserved local state once the post-install 565 // Try and delete the preserved local state once the post-install
558 // operations are complete. 566 // operations are complete.
559 if (!local_state_path.empty()) 567 if (!local_state_path.empty())
560 file_util::Delete(local_state_path, false); 568 file_util::Delete(local_state_path, false);
561 569
562 return ret; 570 return ret;
563 } 571 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698