| 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 28 matching lines...) Expand all Loading... |
| 39 #include "chrome/installer/util/google_update_constants.h" | 39 #include "chrome/installer/util/google_update_constants.h" |
| 40 #include "chrome/installer/util/google_update_settings.h" | 40 #include "chrome/installer/util/google_update_settings.h" |
| 41 #include "chrome/installer/util/helper.h" | 41 #include "chrome/installer/util/helper.h" |
| 42 #include "chrome/installer/util/install_util.h" | 42 #include "chrome/installer/util/install_util.h" |
| 43 #include "chrome/installer/util/installation_state.h" | 43 #include "chrome/installer/util/installation_state.h" |
| 44 #include "chrome/installer/util/installer_state.h" | 44 #include "chrome/installer/util/installer_state.h" |
| 45 #include "chrome/installer/util/logging_installer.h" | 45 #include "chrome/installer/util/logging_installer.h" |
| 46 #include "chrome/installer/util/self_cleaning_temp_dir.h" | 46 #include "chrome/installer/util/self_cleaning_temp_dir.h" |
| 47 #include "chrome/installer/util/shell_util.h" | 47 #include "chrome/installer/util/shell_util.h" |
| 48 #include "chrome/installer/util/util_constants.h" | 48 #include "chrome/installer/util/util_constants.h" |
| 49 #include "chrome/installer/util/work_item.h" |
| 49 #include "content/public/common/result_codes.h" | 50 #include "content/public/common/result_codes.h" |
| 50 #include "rlz/lib/rlz_lib.h" | 51 #include "rlz/lib/rlz_lib.h" |
| 51 | 52 |
| 52 using base::win::RegKey; | 53 using base::win::RegKey; |
| 53 | 54 |
| 54 namespace installer { | 55 namespace installer { |
| 55 | 56 |
| 56 namespace { | 57 namespace { |
| 57 | 58 |
| 58 // Avoid leaving behind a Temp dir. If one exists, ask SelfCleaningTempDir to | 59 // Avoid leaving behind a Temp dir. If one exists, ask SelfCleaningTempDir to |
| (...skipping 28 matching lines...) Expand all Loading... |
| 87 for (size_t i = 0; i < dist_types.size(); ++i) { | 88 for (size_t i = 0; i < dist_types.size(); ++i) { |
| 88 BrowserDistribution::Type dist_type = dist_types[i]; | 89 BrowserDistribution::Type dist_type = dist_types[i]; |
| 89 const ProductState* product_state = | 90 const ProductState* product_state = |
| 90 original_state.GetProductState(system_level, dist_type); | 91 original_state.GetProductState(system_level, dist_type); |
| 91 // Only modify other products if they're installed and multi. | 92 // Only modify other products if they're installed and multi. |
| 92 if (product_state != NULL && | 93 if (product_state != NULL && |
| 93 product_state->is_multi_install() && | 94 product_state->is_multi_install() && |
| 94 !product_state->channel().Equals(channel_info)) { | 95 !product_state->channel().Equals(channel_info)) { |
| 95 BrowserDistribution* other_dist = | 96 BrowserDistribution* other_dist = |
| 96 BrowserDistribution::GetSpecificDistribution(dist_type); | 97 BrowserDistribution::GetSpecificDistribution(dist_type); |
| 97 update_list->AddSetRegValueWorkItem(reg_root, other_dist->GetStateKey(), | 98 update_list->AddSetRegValueWorkItem(reg_root, |
| 98 google_update::kRegApField, channel_info.value(), true); | 99 other_dist->GetStateKey(), |
| 100 WorkItem::kWow64Default, |
| 101 google_update::kRegApField, |
| 102 channel_info.value(), |
| 103 true); |
| 99 } else { | 104 } else { |
| 100 LOG_IF(ERROR, | 105 LOG_IF(ERROR, |
| 101 product_state != NULL && product_state->is_multi_install()) | 106 product_state != NULL && product_state->is_multi_install()) |
| 102 << "Channel value for " | 107 << "Channel value for " |
| 103 << BrowserDistribution::GetSpecificDistribution( | 108 << BrowserDistribution::GetSpecificDistribution( |
| 104 dist_type)->GetDisplayName() | 109 dist_type)->GetDisplayName() |
| 105 << " is somehow already set to the desired new value of " | 110 << " is somehow already set to the desired new value of " |
| 106 << channel_info.value(); | 111 << channel_info.value(); |
| 107 } | 112 } |
| 108 } | 113 } |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 std::vector<const wchar_t*> cleared_assocs; | 678 std::vector<const wchar_t*> cleared_assocs; |
| 674 if (installer_state.system_install() || | 679 if (installer_state.system_install() || |
| 675 !browser_entry_suffix.empty() || | 680 !browser_entry_suffix.empty() || |
| 676 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), | 681 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), |
| 677 KEY_QUERY_VALUE).Valid()) { | 682 KEY_QUERY_VALUE).Valid()) { |
| 678 InstallUtil::ValueEquals prog_id_pred(prog_id); | 683 InstallUtil::ValueEquals prog_id_pred(prog_id); |
| 679 for (const wchar_t* const* filetype = | 684 for (const wchar_t* const* filetype = |
| 680 &ShellUtil::kPotentialFileAssociations[0]; *filetype != NULL; | 685 &ShellUtil::kPotentialFileAssociations[0]; *filetype != NULL; |
| 681 ++filetype) { | 686 ++filetype) { |
| 682 if (InstallUtil::DeleteRegistryValueIf( | 687 if (InstallUtil::DeleteRegistryValueIf( |
| 683 root, (classes_path + *filetype).c_str(), NULL, | 688 root, (classes_path + *filetype).c_str(), WorkItem::kWow64Default, |
| 684 prog_id_pred) == InstallUtil::DELETED) { | 689 NULL, prog_id_pred) == InstallUtil::DELETED) { |
| 685 cleared_assocs.push_back(*filetype); | 690 cleared_assocs.push_back(*filetype); |
| 686 } | 691 } |
| 687 } | 692 } |
| 688 } | 693 } |
| 689 | 694 |
| 690 // For all filetype associations in HKLM that have just been removed, attempt | 695 // For all filetype associations in HKLM that have just been removed, attempt |
| 691 // to restore some reasonable value. We have no definitive way of knowing | 696 // to restore some reasonable value. We have no definitive way of knowing |
| 692 // what handlers are the most appropriate, so we use a fixed mapping based on | 697 // what handlers are the most appropriate, so we use a fixed mapping based on |
| 693 // the default values for a fresh install of Windows. | 698 // the default values for a fresh install of Windows. |
| 694 if (root == HKEY_LOCAL_MACHINE) { | 699 if (root == HKEY_LOCAL_MACHINE) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 if (!product.is_chrome() || !installer_state.system_install()) { | 753 if (!product.is_chrome() || !installer_state.system_install()) { |
| 749 const char* install_level = | 754 const char* install_level = |
| 750 installer_state.system_install() ? "system" : "user"; | 755 installer_state.system_install() ? "system" : "user"; |
| 751 VLOG(1) << "No Active Setup processing to do for " << install_level | 756 VLOG(1) << "No Active Setup processing to do for " << install_level |
| 752 << "-level " << distribution->GetDisplayName(); | 757 << "-level " << distribution->GetDisplayName(); |
| 753 return; | 758 return; |
| 754 } | 759 } |
| 755 | 760 |
| 756 const base::string16 active_setup_path( | 761 const base::string16 active_setup_path( |
| 757 InstallUtil::GetActiveSetupPath(distribution)); | 762 InstallUtil::GetActiveSetupPath(distribution)); |
| 758 InstallUtil::DeleteRegistryKey(HKEY_LOCAL_MACHINE, active_setup_path); | 763 InstallUtil::DeleteRegistryKey(HKEY_LOCAL_MACHINE, active_setup_path, |
| 764 WorkItem::kWow64Default); |
| 759 | 765 |
| 760 // Windows leaves keys behind in HKCU\\Software\\(Wow6432Node\\)?Microsoft\\ | 766 // Windows leaves keys behind in HKCU\\Software\\(Wow6432Node\\)?Microsoft\\ |
| 761 // Active Setup\\Installed Components\\{guid} | 767 // Active Setup\\Installed Components\\{guid} |
| 762 // for every user that logged in since system-level Chrome was installed. | 768 // for every user that logged in since system-level Chrome was installed. |
| 763 // This is a problem because Windows compares the value of the Version subkey | 769 // This is a problem because Windows compares the value of the Version subkey |
| 764 // in there with the value of the Version subkey in the matching HKLM entries | 770 // in there with the value of the Version subkey in the matching HKLM entries |
| 765 // before running Chrome's Active Setup so if Chrome was to be reinstalled | 771 // before running Chrome's Active Setup so if Chrome was to be reinstalled |
| 766 // with a lesser version (e.g. switching back to a more stable channel), the | 772 // with a lesser version (e.g. switching back to a more stable channel), the |
| 767 // affected users would not have Chrome's Active Setup called until Chrome | 773 // affected users would not have Chrome's Active Setup called until Chrome |
| 768 // eventually updated passed that user's registered Version. | 774 // eventually updated passed that user's registered Version. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 } | 900 } |
| 895 | 901 |
| 896 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); | 902 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); |
| 897 | 903 |
| 898 // Delete Software\Classes\ChromeHTML. | 904 // Delete Software\Classes\ChromeHTML. |
| 899 const base::string16 prog_id( | 905 const base::string16 prog_id( |
| 900 dist->GetBrowserProgIdPrefix() + browser_entry_suffix); | 906 dist->GetBrowserProgIdPrefix() + browser_entry_suffix); |
| 901 base::string16 reg_prog_id(ShellUtil::kRegClasses); | 907 base::string16 reg_prog_id(ShellUtil::kRegClasses); |
| 902 reg_prog_id.push_back(base::FilePath::kSeparators[0]); | 908 reg_prog_id.push_back(base::FilePath::kSeparators[0]); |
| 903 reg_prog_id.append(prog_id); | 909 reg_prog_id.append(prog_id); |
| 904 InstallUtil::DeleteRegistryKey(root, reg_prog_id); | 910 InstallUtil::DeleteRegistryKey(root, reg_prog_id, WorkItem::kWow64Default); |
| 905 | 911 |
| 906 // Delete Software\Classes\Chrome. | 912 // Delete Software\Classes\Chrome. |
| 907 base::string16 reg_app_id(ShellUtil::kRegClasses); | 913 base::string16 reg_app_id(ShellUtil::kRegClasses); |
| 908 reg_app_id.push_back(base::FilePath::kSeparators[0]); | 914 reg_app_id.push_back(base::FilePath::kSeparators[0]); |
| 909 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId | 915 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId |
| 910 // would otherwise try to figure out the currently installed suffix). | 916 // would otherwise try to figure out the currently installed suffix). |
| 911 reg_app_id.append(dist->GetBaseAppId() + browser_entry_suffix); | 917 reg_app_id.append(dist->GetBaseAppId() + browser_entry_suffix); |
| 912 InstallUtil::DeleteRegistryKey(root, reg_app_id); | 918 InstallUtil::DeleteRegistryKey(root, reg_app_id, WorkItem::kWow64Default); |
| 913 | 919 |
| 914 // Delete all Start Menu Internet registrations that refer to this Chrome. | 920 // Delete all Start Menu Internet registrations that refer to this Chrome. |
| 915 { | 921 { |
| 916 using base::win::RegistryKeyIterator; | 922 using base::win::RegistryKeyIterator; |
| 917 InstallUtil::ProgramCompare open_command_pred(chrome_exe); | 923 InstallUtil::ProgramCompare open_command_pred(chrome_exe); |
| 918 base::string16 client_name; | 924 base::string16 client_name; |
| 919 base::string16 client_key; | 925 base::string16 client_key; |
| 920 base::string16 open_key; | 926 base::string16 open_key; |
| 921 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); | 927 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); |
| 922 iter.Valid(); ++iter) { | 928 iter.Valid(); ++iter) { |
| 923 client_name.assign(iter.Name()); | 929 client_name.assign(iter.Name()); |
| 924 client_key.assign(ShellUtil::kRegStartMenuInternet) | 930 client_key.assign(ShellUtil::kRegStartMenuInternet) |
| 925 .append(1, L'\\') | 931 .append(1, L'\\') |
| 926 .append(client_name); | 932 .append(client_name); |
| 927 open_key.assign(client_key).append(ShellUtil::kRegShellOpen); | 933 open_key.assign(client_key).append(ShellUtil::kRegShellOpen); |
| 928 if (InstallUtil::DeleteRegistryKeyIf(root, client_key, open_key, NULL, | 934 if (InstallUtil::DeleteRegistryKeyIf(root, client_key, open_key, |
| 929 open_command_pred) != InstallUtil::NOT_FOUND) { | 935 WorkItem::kWow64Default, NULL, open_command_pred) |
| 936 != InstallUtil::NOT_FOUND) { |
| 930 // Delete the default value of SOFTWARE\Clients\StartMenuInternet if it | 937 // Delete the default value of SOFTWARE\Clients\StartMenuInternet if it |
| 931 // references this Chrome (i.e., if it was made the default browser). | 938 // references this Chrome (i.e., if it was made the default browser). |
| 932 InstallUtil::DeleteRegistryValueIf( | 939 InstallUtil::DeleteRegistryValueIf( |
| 933 root, ShellUtil::kRegStartMenuInternet, NULL, | 940 root, ShellUtil::kRegStartMenuInternet, WorkItem::kWow64Default, |
| 934 InstallUtil::ValueEquals(client_name)); | 941 NULL, InstallUtil::ValueEquals(client_name)); |
| 935 // Also delete the value for the default user if we're operating in | 942 // Also delete the value for the default user if we're operating in |
| 936 // HKLM. | 943 // HKLM. |
| 937 if (root == HKEY_LOCAL_MACHINE) { | 944 if (root == HKEY_LOCAL_MACHINE) { |
| 938 InstallUtil::DeleteRegistryValueIf( | 945 InstallUtil::DeleteRegistryValueIf( |
| 939 HKEY_USERS, | 946 HKEY_USERS, |
| 940 base::string16(L".DEFAULT\\").append( | 947 base::string16(L".DEFAULT\\").append( |
| 941 ShellUtil::kRegStartMenuInternet).c_str(), | 948 ShellUtil::kRegStartMenuInternet).c_str(), |
| 942 NULL, InstallUtil::ValueEquals(client_name)); | 949 WorkItem::kWow64Default, NULL, |
| 950 InstallUtil::ValueEquals(client_name)); |
| 943 } | 951 } |
| 944 } | 952 } |
| 945 } | 953 } |
| 946 } | 954 } |
| 947 | 955 |
| 948 // Delete Software\RegisteredApplications\Chromium | 956 // Delete Software\RegisteredApplications\Chromium |
| 949 InstallUtil::DeleteRegistryValue( | 957 InstallUtil::DeleteRegistryValue( |
| 950 root, ShellUtil::kRegRegisteredApplications, | 958 root, ShellUtil::kRegRegisteredApplications, |
| 959 WorkItem::kWow64Default, |
| 951 dist->GetBaseAppName() + browser_entry_suffix); | 960 dist->GetBaseAppName() + browser_entry_suffix); |
| 952 | 961 |
| 953 // Delete the App Paths and Applications keys that let Explorer find Chrome: | 962 // Delete the App Paths and Applications keys that let Explorer find Chrome: |
| 954 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 | 963 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 |
| 955 base::string16 app_key(ShellUtil::kRegClasses); | 964 base::string16 app_key(ShellUtil::kRegClasses); |
| 956 app_key.push_back(base::FilePath::kSeparators[0]); | 965 app_key.push_back(base::FilePath::kSeparators[0]); |
| 957 app_key.append(L"Applications"); | 966 app_key.append(L"Applications"); |
| 958 app_key.push_back(base::FilePath::kSeparators[0]); | 967 app_key.push_back(base::FilePath::kSeparators[0]); |
| 959 app_key.append(installer::kChromeExe); | 968 app_key.append(installer::kChromeExe); |
| 960 InstallUtil::DeleteRegistryKey(root, app_key); | 969 InstallUtil::DeleteRegistryKey(root, app_key, WorkItem::kWow64Default); |
| 961 | 970 |
| 962 base::string16 app_path_key(ShellUtil::kAppPathsRegistryKey); | 971 base::string16 app_path_key(ShellUtil::kAppPathsRegistryKey); |
| 963 app_path_key.push_back(base::FilePath::kSeparators[0]); | 972 app_path_key.push_back(base::FilePath::kSeparators[0]); |
| 964 app_path_key.append(installer::kChromeExe); | 973 app_path_key.append(installer::kChromeExe); |
| 965 InstallUtil::DeleteRegistryKey(root, app_path_key); | 974 InstallUtil::DeleteRegistryKey(root, app_path_key, WorkItem::kWow64Default); |
| 966 | 975 |
| 967 // Cleanup OpenWithList and OpenWithProgids: | 976 // Cleanup OpenWithList and OpenWithProgids: |
| 968 // http://msdn.microsoft.com/en-us/library/bb166549 | 977 // http://msdn.microsoft.com/en-us/library/bb166549 |
| 969 base::string16 file_assoc_key; | 978 base::string16 file_assoc_key; |
| 970 base::string16 open_with_list_key; | 979 base::string16 open_with_list_key; |
| 971 base::string16 open_with_progids_key; | 980 base::string16 open_with_progids_key; |
| 972 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; ++i) { | 981 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; ++i) { |
| 973 file_assoc_key.assign(ShellUtil::kRegClasses); | 982 file_assoc_key.assign(ShellUtil::kRegClasses); |
| 974 file_assoc_key.push_back(base::FilePath::kSeparators[0]); | 983 file_assoc_key.push_back(base::FilePath::kSeparators[0]); |
| 975 file_assoc_key.append(ShellUtil::kPotentialFileAssociations[i]); | 984 file_assoc_key.append(ShellUtil::kPotentialFileAssociations[i]); |
| 976 file_assoc_key.push_back(base::FilePath::kSeparators[0]); | 985 file_assoc_key.push_back(base::FilePath::kSeparators[0]); |
| 977 | 986 |
| 978 open_with_list_key.assign(file_assoc_key); | 987 open_with_list_key.assign(file_assoc_key); |
| 979 open_with_list_key.append(L"OpenWithList"); | 988 open_with_list_key.append(L"OpenWithList"); |
| 980 open_with_list_key.push_back(base::FilePath::kSeparators[0]); | 989 open_with_list_key.push_back(base::FilePath::kSeparators[0]); |
| 981 open_with_list_key.append(installer::kChromeExe); | 990 open_with_list_key.append(installer::kChromeExe); |
| 982 InstallUtil::DeleteRegistryKey(root, open_with_list_key); | 991 InstallUtil::DeleteRegistryKey( |
| 992 root, open_with_list_key, WorkItem::kWow64Default); |
| 983 | 993 |
| 984 open_with_progids_key.assign(file_assoc_key); | 994 open_with_progids_key.assign(file_assoc_key); |
| 985 open_with_progids_key.append(ShellUtil::kRegOpenWithProgids); | 995 open_with_progids_key.append(ShellUtil::kRegOpenWithProgids); |
| 986 InstallUtil::DeleteRegistryValue(root, open_with_progids_key, prog_id); | 996 InstallUtil::DeleteRegistryValue(root, open_with_progids_key, |
| 997 WorkItem::kWow64Default, prog_id); |
| 987 } | 998 } |
| 988 | 999 |
| 989 // Cleanup in case Chrome had been made the default browser. | 1000 // Cleanup in case Chrome had been made the default browser. |
| 990 | 1001 |
| 991 // Delete the default value of SOFTWARE\Clients\StartMenuInternet if it | 1002 // Delete the default value of SOFTWARE\Clients\StartMenuInternet if it |
| 992 // references this Chrome. Do this explicitly here for the case where HKCU is | 1003 // references this Chrome. Do this explicitly here for the case where HKCU is |
| 993 // being processed; the iteration above will have no hits since registration | 1004 // being processed; the iteration above will have no hits since registration |
| 994 // lives in HKLM. | 1005 // lives in HKLM. |
| 995 InstallUtil::DeleteRegistryValueIf( | 1006 InstallUtil::DeleteRegistryValueIf( |
| 996 root, ShellUtil::kRegStartMenuInternet, NULL, | 1007 root, ShellUtil::kRegStartMenuInternet, WorkItem::kWow64Default, NULL, |
| 997 InstallUtil::ValueEquals(dist->GetBaseAppName() + browser_entry_suffix)); | 1008 InstallUtil::ValueEquals(dist->GetBaseAppName() + browser_entry_suffix)); |
| 998 | 1009 |
| 999 // Delete each protocol association if it references this Chrome. | 1010 // Delete each protocol association if it references this Chrome. |
| 1000 InstallUtil::ProgramCompare open_command_pred(chrome_exe); | 1011 InstallUtil::ProgramCompare open_command_pred(chrome_exe); |
| 1001 base::string16 parent_key(ShellUtil::kRegClasses); | 1012 base::string16 parent_key(ShellUtil::kRegClasses); |
| 1002 parent_key.push_back(base::FilePath::kSeparators[0]); | 1013 parent_key.push_back(base::FilePath::kSeparators[0]); |
| 1003 const base::string16::size_type base_length = parent_key.size(); | 1014 const base::string16::size_type base_length = parent_key.size(); |
| 1004 base::string16 child_key; | 1015 base::string16 child_key; |
| 1005 for (const wchar_t* const* proto = | 1016 for (const wchar_t* const* proto = |
| 1006 &ShellUtil::kPotentialProtocolAssociations[0]; | 1017 &ShellUtil::kPotentialProtocolAssociations[0]; |
| 1007 *proto != NULL; | 1018 *proto != NULL; |
| 1008 ++proto) { | 1019 ++proto) { |
| 1009 parent_key.resize(base_length); | 1020 parent_key.resize(base_length); |
| 1010 parent_key.append(*proto); | 1021 parent_key.append(*proto); |
| 1011 child_key.assign(parent_key).append(ShellUtil::kRegShellOpen); | 1022 child_key.assign(parent_key).append(ShellUtil::kRegShellOpen); |
| 1012 InstallUtil::DeleteRegistryKeyIf(root, parent_key, child_key, NULL, | 1023 InstallUtil::DeleteRegistryKeyIf(root, parent_key, child_key, |
| 1024 WorkItem::kWow64Default, NULL, |
| 1013 open_command_pred); | 1025 open_command_pred); |
| 1014 } | 1026 } |
| 1015 | 1027 |
| 1016 RemoveFiletypeRegistration(installer_state, root, browser_entry_suffix); | 1028 RemoveFiletypeRegistration(installer_state, root, browser_entry_suffix); |
| 1017 | 1029 |
| 1018 *exit_code = installer::UNINSTALL_SUCCESSFUL; | 1030 *exit_code = installer::UNINSTALL_SUCCESSFUL; |
| 1019 return true; | 1031 return true; |
| 1020 } | 1032 } |
| 1021 | 1033 |
| 1022 void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, | 1034 void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1035 for (size_t i = 0; i < arraysize(roots); ++i) { | 1047 for (size_t i = 0; i < arraysize(roots); ++i) { |
| 1036 base::string16 suffix; | 1048 base::string16 suffix; |
| 1037 if (roots[i] == HKEY_LOCAL_MACHINE) | 1049 if (roots[i] == HKEY_LOCAL_MACHINE) |
| 1038 suffix = ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe); | 1050 suffix = ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe); |
| 1039 | 1051 |
| 1040 // Delete Software\Classes\ChromeExt, | 1052 // Delete Software\Classes\ChromeExt, |
| 1041 base::string16 ext_prog_id(ShellUtil::kRegClasses); | 1053 base::string16 ext_prog_id(ShellUtil::kRegClasses); |
| 1042 ext_prog_id.push_back(base::FilePath::kSeparators[0]); | 1054 ext_prog_id.push_back(base::FilePath::kSeparators[0]); |
| 1043 ext_prog_id.append(kChromeExtProgId); | 1055 ext_prog_id.append(kChromeExtProgId); |
| 1044 ext_prog_id.append(suffix); | 1056 ext_prog_id.append(suffix); |
| 1045 InstallUtil::DeleteRegistryKey(roots[i], ext_prog_id); | 1057 InstallUtil::DeleteRegistryKey(roots[i], ext_prog_id, |
| 1058 WorkItem::kWow64Default); |
| 1046 | 1059 |
| 1047 // Delete Software\Classes\.crx, | 1060 // Delete Software\Classes\.crx, |
| 1048 base::string16 ext_association(ShellUtil::kRegClasses); | 1061 base::string16 ext_association(ShellUtil::kRegClasses); |
| 1049 ext_association.append(L"\\"); | 1062 ext_association.append(L"\\"); |
| 1050 ext_association.append(L".crx"); | 1063 ext_association.append(L".crx"); |
| 1051 InstallUtil::DeleteRegistryKey(roots[i], ext_association); | 1064 InstallUtil::DeleteRegistryKey(roots[i], ext_association, |
| 1065 WorkItem::kWow64Default); |
| 1052 } | 1066 } |
| 1053 } | 1067 } |
| 1054 | 1068 |
| 1055 void UninstallFirewallRules(BrowserDistribution* dist, | 1069 void UninstallFirewallRules(BrowserDistribution* dist, |
| 1056 const base::FilePath& chrome_exe) { | 1070 const base::FilePath& chrome_exe) { |
| 1057 scoped_ptr<FirewallManager> manager = | 1071 scoped_ptr<FirewallManager> manager = |
| 1058 FirewallManager::Create(dist, chrome_exe); | 1072 FirewallManager::Create(dist, chrome_exe); |
| 1059 if (manager) | 1073 if (manager) |
| 1060 manager->RemoveFirewallRules(); | 1074 manager->RemoveFirewallRules(); |
| 1061 } | 1075 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 } | 1135 } |
| 1122 | 1136 |
| 1123 if (is_chrome) { | 1137 if (is_chrome) { |
| 1124 // Chrome is not in use so lets uninstall Chrome by deleting various files | 1138 // Chrome is not in use so lets uninstall Chrome by deleting various files |
| 1125 // and registry entries. Here we will just make best effort and keep going | 1139 // and registry entries. Here we will just make best effort and keep going |
| 1126 // in case of errors. | 1140 // in case of errors. |
| 1127 ClearRlzProductState(); | 1141 ClearRlzProductState(); |
| 1128 // Delete the key that delegate_execute might make. | 1142 // Delete the key that delegate_execute might make. |
| 1129 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 1143 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 1130 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 1144 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
| 1131 chrome::kMetroRegistryPath); | 1145 chrome::kMetroRegistryPath, |
| 1146 WorkItem::kWow64Default); |
| 1132 } | 1147 } |
| 1133 | 1148 |
| 1134 auto_launch_util::DisableAllAutoStartFeatures( | 1149 auto_launch_util::DisableAllAutoStartFeatures( |
| 1135 base::ASCIIToUTF16(chrome::kInitialProfile)); | 1150 base::ASCIIToUTF16(chrome::kInitialProfile)); |
| 1136 | 1151 |
| 1137 // If user-level chrome is self-destructing as a result of encountering a | 1152 // If user-level chrome is self-destructing as a result of encountering a |
| 1138 // system-level chrome, retarget owned non-default shortcuts (app shortcuts, | 1153 // system-level chrome, retarget owned non-default shortcuts (app shortcuts, |
| 1139 // profile shortcuts, etc.) to the system-level chrome. | 1154 // profile shortcuts, etc.) to the system-level chrome. |
| 1140 if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && | 1155 if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && |
| 1141 !installer_state.system_install()) { | 1156 !installer_state.system_install()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1158 // Delete the registry keys (Uninstall key and Version key). | 1173 // Delete the registry keys (Uninstall key and Version key). |
| 1159 HKEY reg_root = installer_state.root_key(); | 1174 HKEY reg_root = installer_state.root_key(); |
| 1160 | 1175 |
| 1161 // Note that we must retrieve the distribution-specific data before deleting | 1176 // Note that we must retrieve the distribution-specific data before deleting |
| 1162 // product.GetVersionKey(). | 1177 // product.GetVersionKey(). |
| 1163 base::string16 distribution_data(browser_dist->GetDistributionData(reg_root)); | 1178 base::string16 distribution_data(browser_dist->GetDistributionData(reg_root)); |
| 1164 | 1179 |
| 1165 // Remove Control Panel uninstall link. | 1180 // Remove Control Panel uninstall link. |
| 1166 if (product.ShouldCreateUninstallEntry()) { | 1181 if (product.ShouldCreateUninstallEntry()) { |
| 1167 InstallUtil::DeleteRegistryKey(reg_root, | 1182 InstallUtil::DeleteRegistryKey(reg_root, |
| 1168 browser_dist->GetUninstallRegPath()); | 1183 browser_dist->GetUninstallRegPath(), |
| 1184 WorkItem::kWow64Default); |
| 1169 } | 1185 } |
| 1170 | 1186 |
| 1171 // Remove Omaha product key. | 1187 // Remove Omaha product key. |
| 1172 InstallUtil::DeleteRegistryKey(reg_root, browser_dist->GetVersionKey()); | 1188 InstallUtil::DeleteRegistryKey(reg_root, browser_dist->GetVersionKey(), |
| 1189 WorkItem::kWow64Default); |
| 1173 | 1190 |
| 1174 // Also try to delete the MSI value in the ClientState key (it might not be | 1191 // Also try to delete the MSI value in the ClientState key (it might not be |
| 1175 // there). This is due to a Google Update behaviour where an uninstall and a | 1192 // there). This is due to a Google Update behaviour where an uninstall and a |
| 1176 // rapid reinstall might result in stale values from the old ClientState key | 1193 // rapid reinstall might result in stale values from the old ClientState key |
| 1177 // being picked up on reinstall. | 1194 // being picked up on reinstall. |
| 1178 product.SetMsiMarker(installer_state.system_install(), false); | 1195 product.SetMsiMarker(installer_state.system_install(), false); |
| 1179 | 1196 |
| 1180 InstallStatus ret = installer::UNKNOWN_STATUS; | 1197 InstallStatus ret = installer::UNKNOWN_STATUS; |
| 1181 | 1198 |
| 1182 if (is_chrome) { | 1199 if (is_chrome) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 chrome_launcher_support::InstallationState level_to_check = | 1271 chrome_launcher_support::InstallationState level_to_check = |
| 1255 installer_state.system_install() ? | 1272 installer_state.system_install() ? |
| 1256 chrome_launcher_support::INSTALLED_AT_SYSTEM_LEVEL : | 1273 chrome_launcher_support::INSTALLED_AT_SYSTEM_LEVEL : |
| 1257 chrome_launcher_support::INSTALLED_AT_USER_LEVEL; | 1274 chrome_launcher_support::INSTALLED_AT_USER_LEVEL; |
| 1258 bool has_legacy_app_launcher = level_to_check == | 1275 bool has_legacy_app_launcher = level_to_check == |
| 1259 chrome_launcher_support::GetAppLauncherInstallationState(); | 1276 chrome_launcher_support::GetAppLauncherInstallationState(); |
| 1260 if (!has_legacy_app_launcher) { | 1277 if (!has_legacy_app_launcher) { |
| 1261 BrowserDistribution* shadow_app_launcher_dist = | 1278 BrowserDistribution* shadow_app_launcher_dist = |
| 1262 BrowserDistribution::GetSpecificDistribution( | 1279 BrowserDistribution::GetSpecificDistribution( |
| 1263 BrowserDistribution::CHROME_APP_HOST); | 1280 BrowserDistribution::CHROME_APP_HOST); |
| 1264 InstallUtil::DeleteRegistryKey(reg_root, | 1281 InstallUtil::DeleteRegistryKey( |
| 1265 shadow_app_launcher_dist->GetVersionKey()); | 1282 reg_root, |
| 1283 shadow_app_launcher_dist->GetVersionKey(), |
| 1284 WorkItem::kWow64Default); |
| 1266 } | 1285 } |
| 1267 } | 1286 } |
| 1268 } | 1287 } |
| 1269 | 1288 |
| 1270 if (installer_state.is_multi_install()) | 1289 if (installer_state.is_multi_install()) |
| 1271 ProcessGoogleUpdateItems(original_state, installer_state, product); | 1290 ProcessGoogleUpdateItems(original_state, installer_state, product); |
| 1272 | 1291 |
| 1273 // Get the state of the installed product (if any) | 1292 // Get the state of the installed product (if any) |
| 1274 const ProductState* product_state = | 1293 const ProductState* product_state = |
| 1275 original_state.GetProductState(installer_state.system_install(), | 1294 original_state.GetProductState(installer_state.system_install(), |
| 1276 browser_dist->GetType()); | 1295 browser_dist->GetType()); |
| 1277 | 1296 |
| 1278 // Delete shared registry keys as well (these require admin rights) if | 1297 // Delete shared registry keys as well (these require admin rights) if |
| 1279 // remove_all option is specified. | 1298 // remove_all option is specified. |
| 1280 if (remove_all) { | 1299 if (remove_all) { |
| 1281 if (!InstallUtil::IsChromeSxSProcess() && is_chrome) { | 1300 if (!InstallUtil::IsChromeSxSProcess() && is_chrome) { |
| 1282 // Delete media player registry key that exists only in HKLM. | 1301 // Delete media player registry key that exists only in HKLM. |
| 1283 // We don't delete this key in SxS uninstall or Chrome Frame uninstall | 1302 // We don't delete this key in SxS uninstall or Chrome Frame uninstall |
| 1284 // as we never set the key for those products. | 1303 // as we never set the key for those products. |
| 1285 base::string16 reg_path(installer::kMediaPlayerRegPath); | 1304 base::string16 reg_path(installer::kMediaPlayerRegPath); |
| 1286 reg_path.push_back(base::FilePath::kSeparators[0]); | 1305 reg_path.push_back(base::FilePath::kSeparators[0]); |
| 1287 reg_path.append(installer::kChromeExe); | 1306 reg_path.append(installer::kChromeExe); |
| 1288 InstallUtil::DeleteRegistryKey(HKEY_LOCAL_MACHINE, reg_path); | 1307 InstallUtil::DeleteRegistryKey(HKEY_LOCAL_MACHINE, reg_path, |
| 1308 WorkItem::kWow64Default); |
| 1289 } | 1309 } |
| 1290 | 1310 |
| 1291 // Unregister any dll servers that we may have registered for this | 1311 // Unregister any dll servers that we may have registered for this |
| 1292 // product. | 1312 // product. |
| 1293 if (product_state != NULL) { | 1313 if (product_state != NULL) { |
| 1294 std::vector<base::FilePath> com_dll_list; | 1314 std::vector<base::FilePath> com_dll_list; |
| 1295 product.AddComDllList(&com_dll_list); | 1315 product.AddComDllList(&com_dll_list); |
| 1296 base::FilePath dll_folder = installer_state.target_path().AppendASCII( | 1316 base::FilePath dll_folder = installer_state.target_path().AppendASCII( |
| 1297 product_state->version().GetString()); | 1317 product_state->version().GetString()); |
| 1298 | 1318 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 // If we need a reboot to continue, schedule the parent directories for | 1458 // If we need a reboot to continue, schedule the parent directories for |
| 1439 // deletion unconditionally. If they are not empty, the session manager | 1459 // deletion unconditionally. If they are not empty, the session manager |
| 1440 // will not delete them on reboot. | 1460 // will not delete them on reboot. |
| 1441 ScheduleParentAndGrandparentForDeletion(target_path); | 1461 ScheduleParentAndGrandparentForDeletion(target_path); |
| 1442 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { | 1462 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { |
| 1443 *uninstall_status = UNINSTALL_FAILED; | 1463 *uninstall_status = UNINSTALL_FAILED; |
| 1444 } | 1464 } |
| 1445 } | 1465 } |
| 1446 | 1466 |
| 1447 } // namespace installer | 1467 } // namespace installer |
| OLD | NEW |