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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 11196008: Remove old/no longer needed removal code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r162271 Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 // Windows 8. 728 // Windows 8.
729 bool LaunchApplicationAssociationDialog(const string16& app_id) { 729 bool LaunchApplicationAssociationDialog(const string16& app_id) {
730 base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui; 730 base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui;
731 HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI); 731 HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI);
732 if (FAILED(hr)) 732 if (FAILED(hr))
733 return false; 733 return false;
734 hr = aarui->LaunchAdvancedAssociationUI(app_id.c_str()); 734 hr = aarui->LaunchAdvancedAssociationUI(app_id.c_str());
735 return SUCCEEDED(hr); 735 return SUCCEEDED(hr);
736 } 736 }
737 737
738 // As of r133333, the DelegateExecute verb handler was being registered for
739 // Google Chrome installs on Windows 8 even though the binary itself wasn't
740 // present. This affected Chrome 20.0.1115.1 on the dev channel (and anyone who
741 // pulled a Canary >= 20.0.1112.0 and installed it manually as Google Chrome).
742 // This egregious hack is here to remove the bad values for those installs, and
743 // should be removed after a reasonable time, say 2012-08-01. Anyone on Win8
744 // dev channel who hasn't been autoupdated or manually updated by then will have
745 // to uninstall and reinstall Chrome to repair. See http://crbug.com/124666 and
746 // http://crbug.com/123994 for gory details.
747 // This function is also used to remove DelegateExecute verb handler
748 // registrations on builds for which Metro is no longer supported. This will
749 // also become irrelevant sometime after Windows 8 RC (thus the aforementioned
750 // removal date remains correct).
751 void RemoveBadWindows8RegistrationIfNeeded(
752 BrowserDistribution* dist,
753 const string16& chrome_exe) {
754 if (dist->GetCommandExecuteImplClsid(NULL) &&
755 (!InstallUtil::HasDelegateExecuteHandler(dist, chrome_exe) ||
756 !IsChromeMetroSupported())) {
757 // There's no need to rollback, so forgo the usual work item lists and just
758 // remove the values from the registry.
759 bool is_per_user_install =
760 InstallUtil::IsPerUserInstall(chrome_exe.c_str());
761 const HKEY root_key = is_per_user_install ? HKEY_CURRENT_USER :
762 HKEY_LOCAL_MACHINE;
763 // Use the current installation's suffix, not the about-to-be-installed
764 // suffix.
765 const string16 installation_suffix(
766 ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe));
767 const string16 app_id(ShellUtil::GetBrowserModelId(dist,
768 is_per_user_install));
769
770 // <root hkey>\Software\Classes\<app_id>
771 string16 key(ShellUtil::kRegClasses);
772 key.push_back(FilePath::kSeparators[0]);
773 key.append(app_id);
774 InstallUtil::DeleteRegistryKey(root_key, key);
775
776 // <root hkey>\Software\Classes\ChromiumHTML[.user]\shell\open\command
777 key = ShellUtil::kRegClasses;
778 key.push_back(FilePath::kSeparators[0]);
779 key.append(GetBrowserProgId(installation_suffix));
780 key.append(ShellUtil::kRegShellOpen);
781 InstallUtil::DeleteRegistryValue(root_key, key,
782 ShellUtil::kRegDelegateExecute);
783 }
784 }
785
786 // Returns true if the current install's |chrome_exe| has been registered with 738 // Returns true if the current install's |chrome_exe| has been registered with
787 // |suffix|. 739 // |suffix|.
788 // |confirmation_level| is the level of verification desired as described in 740 // |confirmation_level| is the level of verification desired as described in
789 // the RegistrationConfirmationLevel enum above. 741 // the RegistrationConfirmationLevel enum above.
790 // |suffix| can be the empty string (this is used to support old installs 742 // |suffix| can be the empty string (this is used to support old installs
791 // where we used to not suffix user-level installs if they were the first to 743 // where we used to not suffix user-level installs if they were the first to
792 // request the non-suffixed registry entries on the machine). 744 // request the non-suffixed registry entries on the machine).
793 // NOTE: This a quick check that only validates that a single registry entry 745 // NOTE: This a quick check that only validates that a single registry entry
794 // points to |chrome_exe|. This should only be used at run-time to determine 746 // points to |chrome_exe|. This should only be used at run-time to determine
795 // how Chrome is registered, not to know whether the registration is complete 747 // how Chrome is registered, not to know whether the registration is complete
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 962 }
1011 963
1012 if (properties.has_dual_mode()) 964 if (properties.has_dual_mode())
1013 shortcut_properties.set_dual_mode(properties.dual_mode); 965 shortcut_properties.set_dual_mode(properties.dual_mode);
1014 966
1015 return shortcut_properties; 967 return shortcut_properties;
1016 } 968 }
1017 969
1018 // Cleans up an old verb (run) we used to register in 970 // Cleans up an old verb (run) we used to register in
1019 // <root>\Software\Classes\Chrome<.suffix>\.exe\shell\run on Windows 8. 971 // <root>\Software\Classes\Chrome<.suffix>\.exe\shell\run on Windows 8.
1020 // TODO (gab): This was fixed before the general availability of Windows 8 and
1021 // thus can safely be removed in February 2013.
1022 void RemoveRunVerbOnWindows8( 972 void RemoveRunVerbOnWindows8(
1023 BrowserDistribution* dist, 973 BrowserDistribution* dist,
1024 const string16& chrome_exe) { 974 const string16& chrome_exe) {
1025 if (IsChromeMetroSupported()) { 975 if (IsChromeMetroSupported()) {
1026 bool is_per_user_install =InstallUtil::IsPerUserInstall(chrome_exe.c_str()); 976 bool is_per_user_install =InstallUtil::IsPerUserInstall(chrome_exe.c_str());
1027 HKEY root_key = DetermineShellIntegrationRoot(is_per_user_install); 977 HKEY root_key = DetermineShellIntegrationRoot(is_per_user_install);
1028 // There's no need to rollback, so forgo the usual work item lists and just 978 // There's no need to rollback, so forgo the usual work item lists and just
1029 // remove the key from the registry. 979 // remove the key from the registry.
1030 string16 run_verb_key(ShellUtil::kRegClasses); 980 string16 run_verb_key(ShellUtil::kRegClasses);
1031 run_verb_key.push_back(FilePath::kSeparators[0]); 981 run_verb_key.push_back(FilePath::kSeparators[0]);
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 if (!dist->CanSetAsDefault()) 1657 if (!dist->CanSetAsDefault())
1708 return false; 1658 return false;
1709 1659
1710 string16 suffix; 1660 string16 suffix;
1711 if (!unique_suffix.empty()) { 1661 if (!unique_suffix.empty()) {
1712 suffix = unique_suffix; 1662 suffix = unique_suffix;
1713 } else if (!GetInstallationSpecificSuffix(dist, chrome_exe, &suffix)) { 1663 } else if (!GetInstallationSpecificSuffix(dist, chrome_exe, &suffix)) {
1714 return false; 1664 return false;
1715 } 1665 }
1716 1666
1717 // TODO(grt): remove this on or after 2012-08-01; see impl for details.
1718 RemoveBadWindows8RegistrationIfNeeded(dist, chrome_exe);
1719
1720 // TODO(gab): remove this on or after 2013-02-01; see impl for details.
1721 RemoveRunVerbOnWindows8(dist, chrome_exe); 1667 RemoveRunVerbOnWindows8(dist, chrome_exe);
1722 1668
1723 // Check if Chromium is already registered with this suffix. 1669 // Check if Chromium is already registered with this suffix.
1724 if (IsChromeRegistered(dist, chrome_exe, suffix)) 1670 if (IsChromeRegistered(dist, chrome_exe, suffix))
1725 return true; 1671 return true;
1726 1672
1727 bool user_level = InstallUtil::IsPerUserInstall(chrome_exe.c_str()); 1673 bool user_level = InstallUtil::IsPerUserInstall(chrome_exe.c_str());
1728 HKEY root = DetermineShellIntegrationRoot(user_level); 1674 HKEY root = DetermineShellIntegrationRoot(user_level);
1729 1675
1730 // Do the full registration if we can do it at user-level or if the user is an 1676 // Do the full registration if we can do it at user-level or if the user is an
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 // are any left...). 1885 // are any left...).
1940 if (free_bits >= 8 && next_byte_index < size) { 1886 if (free_bits >= 8 && next_byte_index < size) {
1941 free_bits -= 8; 1887 free_bits -= 8;
1942 bit_stream += bytes[next_byte_index++] << free_bits; 1888 bit_stream += bytes[next_byte_index++] << free_bits;
1943 } 1889 }
1944 } 1890 }
1945 1891
1946 DCHECK_EQ(ret.length(), encoded_length); 1892 DCHECK_EQ(ret.length(), encoded_length);
1947 return ret; 1893 return ret;
1948 } 1894 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698