| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 content::RESULT_CODE_HUNG, NULL); | 219 content::RESULT_CODE_HUNG, NULL); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 // This method tries to figure out if current user has registered Chrome. | 223 // This method tries to figure out if current user has registered Chrome. |
| 224 // It returns true iff there is a registered browser that will launch the | 224 // It returns true iff there is a registered browser that will launch the |
| 225 // same chrome.exe as the current installation. | 225 // same chrome.exe as the current installation. |
| 226 bool CurrentUserHasDefaultBrowser(const InstallerState& installer_state) { | 226 bool CurrentUserHasDefaultBrowser(const InstallerState& installer_state) { |
| 227 using base::win::RegistryKeyIterator; | 227 using base::win::RegistryKeyIterator; |
| 228 const HKEY root = HKEY_LOCAL_MACHINE; | 228 const HKEY root = HKEY_LOCAL_MACHINE; |
| 229 ProgramCompare open_command_pred( | 229 InstallUtil::ProgramCompare open_command_pred( |
| 230 installer_state.target_path().Append(kChromeExe)); | 230 installer_state.target_path().Append(kChromeExe)); |
| 231 string16 client_open_path; | 231 string16 client_open_path; |
| 232 RegKey client_open_key; | 232 RegKey client_open_key; |
| 233 string16 reg_exe; | 233 string16 reg_exe; |
| 234 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); | 234 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); |
| 235 iter.Valid(); ++iter) { | 235 iter.Valid(); ++iter) { |
| 236 client_open_path.assign(ShellUtil::kRegStartMenuInternet) | 236 client_open_path.assign(ShellUtil::kRegStartMenuInternet) |
| 237 .append(1, L'\\') | 237 .append(1, L'\\') |
| 238 .append(iter.Name()) | 238 .append(iter.Name()) |
| 239 .append(ShellUtil::kRegShellOpen); | 239 .append(ShellUtil::kRegShellOpen); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 559 |
| 560 // Delete Software\Classes\Chrome (Same comment as above applies for this too) | 560 // Delete Software\Classes\Chrome (Same comment as above applies for this too) |
| 561 string16 chrome_app_id(ShellUtil::kRegClasses); | 561 string16 chrome_app_id(ShellUtil::kRegClasses); |
| 562 chrome_app_id.push_back(FilePath::kSeparators[0]); | 562 chrome_app_id.push_back(FilePath::kSeparators[0]); |
| 563 chrome_app_id.append(dist->GetBrowserAppId()); | 563 chrome_app_id.append(dist->GetBrowserAppId()); |
| 564 InstallUtil::DeleteRegistryKey(root, chrome_app_id); | 564 InstallUtil::DeleteRegistryKey(root, chrome_app_id); |
| 565 | 565 |
| 566 // Delete all Start Menu Internet registrations that refer to this Chrome. | 566 // Delete all Start Menu Internet registrations that refer to this Chrome. |
| 567 { | 567 { |
| 568 using base::win::RegistryKeyIterator; | 568 using base::win::RegistryKeyIterator; |
| 569 ProgramCompare open_command_pred(chrome_exe); | 569 InstallUtil::ProgramCompare open_command_pred(chrome_exe); |
| 570 string16 client_name; | 570 string16 client_name; |
| 571 string16 client_key; | 571 string16 client_key; |
| 572 string16 open_key; | 572 string16 open_key; |
| 573 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); | 573 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); |
| 574 iter.Valid(); ++iter) { | 574 iter.Valid(); ++iter) { |
| 575 client_name.assign(iter.Name()); | 575 client_name.assign(iter.Name()); |
| 576 client_key.assign(ShellUtil::kRegStartMenuInternet) | 576 client_key.assign(ShellUtil::kRegStartMenuInternet) |
| 577 .append(1, L'\\') | 577 .append(1, L'\\') |
| 578 .append(client_name); | 578 .append(client_name); |
| 579 open_key.assign(client_key).append(ShellUtil::kRegShellOpen); | 579 open_key.assign(client_key).append(ShellUtil::kRegShellOpen); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // Delete the default value of SOFTWARE\Clients\StartMenuInternet if it | 633 // Delete the default value of SOFTWARE\Clients\StartMenuInternet if it |
| 634 // references this Chrome. Do this explicitly here for the case where HKCU is | 634 // references this Chrome. Do this explicitly here for the case where HKCU is |
| 635 // being processed; the iteration above will have no hits since registration | 635 // being processed; the iteration above will have no hits since registration |
| 636 // lives in HKLM. | 636 // lives in HKLM. |
| 637 InstallUtil::DeleteRegistryValueIf( | 637 InstallUtil::DeleteRegistryValueIf( |
| 638 root, ShellUtil::kRegStartMenuInternet, L"", | 638 root, ShellUtil::kRegStartMenuInternet, L"", |
| 639 InstallUtil::ValueEquals(dist->GetApplicationName() + | 639 InstallUtil::ValueEquals(dist->GetApplicationName() + |
| 640 browser_entry_suffix)); | 640 browser_entry_suffix)); |
| 641 | 641 |
| 642 // Delete each protocol association if it references this Chrome. | 642 // Delete each protocol association if it references this Chrome. |
| 643 ProgramCompare open_command_pred(chrome_exe); | 643 InstallUtil::ProgramCompare open_command_pred(chrome_exe); |
| 644 string16 parent_key(ShellUtil::kRegClasses); | 644 string16 parent_key(ShellUtil::kRegClasses); |
| 645 const string16::size_type base_length = parent_key.size(); | 645 const string16::size_type base_length = parent_key.size(); |
| 646 string16 child_key; | 646 string16 child_key; |
| 647 for (const wchar_t* const* proto = | 647 for (const wchar_t* const* proto = |
| 648 &ShellUtil::kPotentialProtocolAssociations[0]; | 648 &ShellUtil::kPotentialProtocolAssociations[0]; |
| 649 *proto != NULL; | 649 *proto != NULL; |
| 650 ++proto) { | 650 ++proto) { |
| 651 parent_key.resize(base_length); | 651 parent_key.resize(base_length); |
| 652 parent_key.push_back(FilePath::kSeparators[0]); | 652 parent_key.push_back(FilePath::kSeparators[0]); |
| 653 parent_key.append(*proto); | 653 parent_key.append(*proto); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 952 |
| 953 // Try and delete the preserved local state once the post-install | 953 // Try and delete the preserved local state once the post-install |
| 954 // operations are complete. | 954 // operations are complete. |
| 955 if (!backup_state_file.empty()) | 955 if (!backup_state_file.empty()) |
| 956 file_util::Delete(backup_state_file, false); | 956 file_util::Delete(backup_state_file, false); |
| 957 | 957 |
| 958 return ret; | 958 return ret; |
| 959 } | 959 } |
| 960 | 960 |
| 961 } // namespace installer | 961 } // namespace installer |
| OLD | NEW |