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 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 // DelegateExecute ProgId. Needed for Chrome Metro in Windows 8. | 232 // DelegateExecute ProgId. Needed for Chrome Metro in Windows 8. |
233 if (set_delegate_execute) { | 233 if (set_delegate_execute) { |
234 string16 model_id_shell(ShellUtil::kRegClasses); | 234 string16 model_id_shell(ShellUtil::kRegClasses); |
235 model_id_shell.push_back(FilePath::kSeparators[0]); | 235 model_id_shell.push_back(FilePath::kSeparators[0]); |
236 model_id_shell.append(app_id); | 236 model_id_shell.append(app_id); |
237 model_id_shell.append(ShellUtil::kRegExePath); | 237 model_id_shell.append(ShellUtil::kRegExePath); |
238 model_id_shell.append(ShellUtil::kRegShellPath); | 238 model_id_shell.append(ShellUtil::kRegShellPath); |
239 | 239 |
240 // <root hkey>\Software\Classes\<app_id>\.exe\shell @=open | 240 // <root hkey>\Software\Classes\<app_id>\.exe\shell @=open |
241 entries->push_back(new RegistryEntry(model_id_shell, | 241 entries->push_back(new RegistryEntry(model_id_shell, |
242 ShellUtil::kRegVerbOpen)); | 242 ShellUtil::kRegVerbOpen)); |
243 | 243 |
244 const wchar_t* const verbs[] = { ShellUtil::kRegVerbOpen, | 244 const wchar_t* const verbs[] = { ShellUtil::kRegVerbOpen, |
245 ShellUtil::kRegVerbOpenNewWindow, | 245 ShellUtil::kRegVerbOpenNewWindow }; |
246 ShellUtil::kRegVerbRun }; | |
247 for (size_t i = 0; i < arraysize(verbs); ++i) { | 246 for (size_t i = 0; i < arraysize(verbs); ++i) { |
248 string16 sub_path(model_id_shell); | 247 string16 sub_path(model_id_shell); |
249 sub_path.push_back(FilePath::kSeparators[0]); | 248 sub_path.push_back(FilePath::kSeparators[0]); |
250 sub_path.append(verbs[i]); | 249 sub_path.append(verbs[i]); |
251 | 250 |
252 // <root hkey>\Software\Classes\<app_id>\.exe\shell\<verb> | 251 // <root hkey>\Software\Classes\<app_id>\.exe\shell\<verb> |
253 entries->push_back(new RegistryEntry( | 252 entries->push_back(new RegistryEntry( |
254 sub_path, L"CommandId", L"Browser.Launch")); | 253 sub_path, L"CommandId", L"Browser.Launch")); |
255 | 254 |
256 sub_path.push_back(FilePath::kSeparators[0]); | 255 sub_path.push_back(FilePath::kSeparators[0]); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 return false; | 732 return false; |
734 hr = aarui->LaunchAdvancedAssociationUI(app_id.c_str()); | 733 hr = aarui->LaunchAdvancedAssociationUI(app_id.c_str()); |
735 return SUCCEEDED(hr); | 734 return SUCCEEDED(hr); |
736 } | 735 } |
737 | 736 |
738 // As of r133333, the DelegateExecute verb handler was being registered for | 737 // 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 | 738 // 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 | 739 // 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). | 740 // 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 | 741 // 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 | 742 // should be removed after a reasonable time, say 2012-08-01 (pushed back see |
grt (UTC plus 2)
2012/10/13 00:34:26
what do you think about retiring the old "remove b
gab
2012/10/13 03:33:12
Yea, I was tempted by that, but I want to merge th
grt (UTC plus 2)
2012/10/13 13:21:37
Okay
| |
744 // dev channel who hasn't been autoupdated or manually updated by then will have | 743 // below). Anyone on Win8 dev channel who hasn't been autoupdated or manually |
745 // to uninstall and reinstall Chrome to repair. See http://crbug.com/124666 and | 744 // updated by then will have to uninstall and reinstall Chrome to repair. |
746 // http://crbug.com/123994 for gory details. | 745 // See http://crbug.com/124666 and http://crbug.com/123994 for gory details. |
747 // This function is also used to remove DelegateExecute verb handler | 746 // This function is also used to remove DelegateExecute verb handler |
748 // registrations on builds for which Metro is no longer supported. This will | 747 // registrations on builds for which Metro is no longer supported. This will |
749 // also become irrelevant sometime after Windows 8 RC (thus the aforementioned | 748 // also become irrelevant sometime after Windows 8 RC (thus the aforementioned |
750 // removal date remains correct). | 749 // removal date remains correct). |
750 // For installs where we do register the Windows 8 only registrations, this | |
751 // method will clean up an old verb (run) we used to register in | |
752 // <root>\Software\Classes\Chrome<suffix>\.exe\shell\run. | |
753 // TODO (gab): This was fixed before the official release of Windows 8 and thus | |
grt (UTC plus 2)
2012/10/13 00:34:26
i think it's too late for this to be on stable bef
gab
2012/10/13 03:33:12
As mentioned above, my intent is to merge it in bo
grt (UTC plus 2)
2012/10/13 13:21:37
Merging it will not guarantee that.
grt (UTC plus 2)
2012/10/13 17:50:29
To elaborate, there will be a population of machin
gab
2012/10/13 19:02:09
Right, but see my reply/clarification on the bug.
gab
2012/10/15 21:15:57
Done.
| |
754 // can safely be removed in February 2013. | |
751 void RemoveBadWindows8RegistrationIfNeeded( | 755 void RemoveBadWindows8RegistrationIfNeeded( |
752 BrowserDistribution* dist, | 756 BrowserDistribution* dist, |
753 const string16& chrome_exe) { | 757 const string16& chrome_exe) { |
758 // There's no need to rollback, so forgo the usual work item lists and just | |
759 // remove the values from the registry. | |
760 bool is_per_user_install = | |
761 InstallUtil::IsPerUserInstall(chrome_exe.c_str()); | |
762 const HKEY root_key = is_per_user_install ? HKEY_CURRENT_USER : | |
763 HKEY_LOCAL_MACHINE; | |
754 if (dist->GetCommandExecuteImplClsid(NULL) && | 764 if (dist->GetCommandExecuteImplClsid(NULL) && |
755 (!InstallUtil::HasDelegateExecuteHandler(dist, chrome_exe) || | 765 (!InstallUtil::HasDelegateExecuteHandler(dist, chrome_exe) || |
756 !IsChromeMetroSupported())) { | 766 !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 | 767 // Use the current installation's suffix, not the about-to-be-installed |
764 // suffix. | 768 // suffix. |
765 const string16 installation_suffix( | 769 const string16 installation_suffix( |
766 ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe)); | 770 ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe)); |
767 const string16 app_id(ShellUtil::GetBrowserModelId(dist, | 771 const string16 app_id(ShellUtil::GetBrowserModelId(dist, |
768 is_per_user_install)); | 772 is_per_user_install)); |
769 | 773 |
770 // <root hkey>\Software\Classes\<app_id> | 774 // <root hkey>\Software\Classes\<app_id> |
771 string16 key(ShellUtil::kRegClasses); | 775 string16 key(ShellUtil::kRegClasses); |
772 key.push_back(FilePath::kSeparators[0]); | 776 key.push_back(FilePath::kSeparators[0]); |
773 key.append(app_id); | 777 key.append(app_id); |
774 InstallUtil::DeleteRegistryKey(root_key, key); | 778 InstallUtil::DeleteRegistryKey(root_key, key); |
775 | 779 |
776 // <root hkey>\Software\Classes\ChromiumHTML[.user]\shell\open\command | 780 // <root hkey>\Software\Classes\ChromiumHTML[.user]\shell\open\command |
777 key = ShellUtil::kRegClasses; | 781 key = ShellUtil::kRegClasses; |
778 key.push_back(FilePath::kSeparators[0]); | 782 key.push_back(FilePath::kSeparators[0]); |
779 key.append(GetBrowserProgId(installation_suffix)); | 783 key.append(GetBrowserProgId(installation_suffix)); |
780 key.append(ShellUtil::kRegShellOpen); | 784 key.append(ShellUtil::kRegShellOpen); |
781 InstallUtil::DeleteRegistryValue(root_key, key, | 785 InstallUtil::DeleteRegistryValue(root_key, key, |
782 ShellUtil::kRegDelegateExecute); | 786 ShellUtil::kRegDelegateExecute); |
787 } else { | |
788 string16 run_verb_key(ShellUtil::kRegClasses); | |
grt (UTC plus 2)
2012/10/13 00:34:26
this code is nearly impenetrable. please add a com
gab
2012/10/13 03:33:12
Done.
| |
789 run_verb_key.push_back(FilePath::kSeparators[0]); | |
790 run_verb_key.append(ShellUtil::GetBrowserModelId( | |
791 dist, InstallUtil::IsPerUserInstall(chrome_exe.c_str()))); | |
792 run_verb_key.append(ShellUtil::kRegExePath); | |
793 run_verb_key.append(ShellUtil::kRegShellPath); | |
794 run_verb_key.push_back(FilePath::kSeparators[0]); | |
795 run_verb_key.append(ShellUtil::kRegVerbRun); | |
796 InstallUtil::DeleteRegistryKey(root_key, run_verb_key); | |
grt (UTC plus 2)
2012/10/13 00:34:26
this could be in HKCU even for a system-level inst
gab
2012/10/13 03:33:12
No, on Win8 all user level stuff is in HKCU and sy
grt (UTC plus 2)
2012/10/13 13:21:37
I expect there to be a great number of machines up
gab
2012/10/13 15:17:50
Well technically if this is merged in M22 and M23
grt (UTC plus 2)
2012/10/13 17:50:29
Ah, I just realized that the Win7 -> Win8 path is
gab
2012/10/13 19:02:09
Well not quite, the migration can also happen on n
| |
783 } | 797 } |
784 } | 798 } |
785 | 799 |
786 // Returns true if the current install's |chrome_exe| has been registered with | 800 // Returns true if the current install's |chrome_exe| has been registered with |
787 // |suffix|. | 801 // |suffix|. |
788 // |confirmation_level| is the level of verification desired as described in | 802 // |confirmation_level| is the level of verification desired as described in |
789 // the RegistrationConfirmationLevel enum above. | 803 // the RegistrationConfirmationLevel enum above. |
790 // |suffix| can be the empty string (this is used to support old installs | 804 // |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 | 805 // 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). | 806 // request the non-suffixed registry entries on the machine). |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1738 // are any left...). | 1752 // are any left...). |
1739 if (free_bits >= 8 && next_byte_index < size) { | 1753 if (free_bits >= 8 && next_byte_index < size) { |
1740 free_bits -= 8; | 1754 free_bits -= 8; |
1741 bit_stream += bytes[next_byte_index++] << free_bits; | 1755 bit_stream += bytes[next_byte_index++] << free_bits; |
1742 } | 1756 } |
1743 } | 1757 } |
1744 | 1758 |
1745 DCHECK_EQ(ret.length(), encoded_length); | 1759 DCHECK_EQ(ret.length(), encoded_length); |
1746 return ret; | 1760 return ret; |
1747 } | 1761 } |
OLD | NEW |