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

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

Issue 6961013: Allow chrome to become the os default handler for arbitrary protocols on mac/win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More changes for comments; fix for a bug introduced with DefaultWebClientWorker refactoring Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include <windows.h> 5 #include <windows.h>
6 #include <msi.h> 6 #include <msi.h>
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { 825 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) {
826 // Check if we need to show the EULA. If it is passed as a command line 826 // Check if we need to show the EULA. If it is passed as a command line
827 // then the dialog is shown and regardless of the outcome setup exits here. 827 // then the dialog is shown and regardless of the outcome setup exits here.
828 std::wstring inner_frame = 828 std::wstring inner_frame =
829 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); 829 cmd_line.GetSwitchValueNative(installer::switches::kShowEula);
830 *exit_code = ShowEULADialog(inner_frame); 830 *exit_code = ShowEULADialog(inner_frame);
831 if (installer::EULA_REJECTED != *exit_code) 831 if (installer::EULA_REJECTED != *exit_code)
832 GoogleUpdateSettings::SetEULAConsent(*installer_state, true); 832 GoogleUpdateSettings::SetEULAConsent(*installer_state, true);
833 } else if (cmd_line.HasSwitch( 833 } else if (cmd_line.HasSwitch(
834 installer::switches::kRegisterChromeBrowser)) { 834 installer::switches::kRegisterChromeBrowser)) {
835 installer::InstallStatus status = installer::UNKNOWN_STATUS;
835 const Product* chrome_install = 836 const Product* chrome_install =
836 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); 837 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER);
837 if (chrome_install) { 838 if (chrome_install) {
838 // If --register-chrome-browser option is specified, register all 839 // If --register-chrome-browser option is specified, register all
839 // Chrome protocol/file associations as well as register it as a valid 840 // Chrome protocol/file associations, as well as register it as a valid
840 // browser for Start Menu->Internet shortcut. This option should only 841 // browser for Start Menu->Internet shortcut. This switch will also
841 // be used when setup.exe is launched with admin rights. We do not 842 // register Chrome as a valid handler for a set of URL protocols that
842 // make any user specific changes in this option. 843 // Chrome may become the default handler for, either by the user marking
844 // Chrome as the default browser, through the Windows Default Programs
845 // control panel settings, or through website use of
846 // registerProtocolHandler. These protocols are found in
847 // ShellUtil::kPotentialProtocolAssociations.
848 // The --register-url-protocol will additionally register Chrome as a
849 // potential handler for the supplied protocol, and is used if a website
850 // registers a handler for a protocol not found in
851 // ShellUtil::kPotentialProtocolAssociations.
grt (UTC plus 2) 2011/05/26 02:42:53 Is registration for a protocol not found in kPoten
852 // These options should only be used when setup.exe is launched with admin
853 // rights. We do not make any user specific changes with this option.
843 std::wstring chrome_exe(cmd_line.GetSwitchValueNative( 854 std::wstring chrome_exe(cmd_line.GetSwitchValueNative(
844 installer::switches::kRegisterChromeBrowser)); 855 installer::switches::kRegisterChromeBrowser));
845 std::wstring suffix; 856 std::wstring suffix;
846 if (cmd_line.HasSwitch( 857 if (cmd_line.HasSwitch(
847 installer::switches::kRegisterChromeBrowserSuffix)) { 858 installer::switches::kRegisterChromeBrowserSuffix)) {
848 suffix = cmd_line.GetSwitchValueNative( 859 suffix = cmd_line.GetSwitchValueNative(
849 installer::switches::kRegisterChromeBrowserSuffix); 860 installer::switches::kRegisterChromeBrowserSuffix);
850 } 861 }
851 *exit_code = ShellUtil::RegisterChromeBrowser( 862 if (cmd_line.HasSwitch(
852 chrome_install->distribution(), chrome_exe, suffix, false); 863 installer::switches::kRegisterURLProtocol)) {
864 std::wstring protocol = cmd_line.GetSwitchValueNative(
865 installer::switches::kRegisterURLProtocol);
866 // ShellUtil::RegisterChromeForProtocol performs all registration
867 // done by ShellUtil::RegisterChromeBrowser, as well as registering
868 // with Winows as capable of handling the supplied protocol.
869 if (ShellUtil::RegisterChromeForProtocol(chrome_install->distribution(),
870 chrome_exe, suffix, protocol, false))
871 status = installer::IN_USE_UPDATED;
872 } else {
873 if (ShellUtil::RegisterChromeBrowser(chrome_install->distribution(),
874 chrome_exe, suffix, false))
875 status = installer::IN_USE_UPDATED;
876 }
853 } else { 877 } else {
854 LOG(DFATAL) << "Can't register browser - Chrome distribution not found"; 878 LOG(DFATAL) << "Can't register browser - Chrome distribution not found";
855 *exit_code = installer::UNKNOWN_STATUS;
856 } 879 }
880 *exit_code = InstallUtil::GetInstallReturnCode(status);
857 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { 881 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) {
858 // If --rename-chrome-exe is specified, we want to rename the executables 882 // If --rename-chrome-exe is specified, we want to rename the executables
859 // and exit. 883 // and exit.
860 *exit_code = RenameChromeExecutables(original_state, installer_state); 884 *exit_code = RenameChromeExecutables(original_state, installer_state);
861 } else if (cmd_line.HasSwitch( 885 } else if (cmd_line.HasSwitch(
862 installer::switches::kRemoveChromeRegistration)) { 886 installer::switches::kRemoveChromeRegistration)) {
863 // This is almost reverse of --register-chrome-browser option above. 887 // This is almost reverse of --register-chrome-browser option above.
864 // Here we delete Chrome browser registration. This option should only 888 // Here we delete Chrome browser registration. This option should only
865 // be used when setup.exe is launched with admin rights. We do not 889 // be used when setup.exe is launched with admin rights. We do not
866 // make any user specific changes in this option. 890 // make any user specific changes in this option.
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 if (!(installer_state.is_msi() && is_uninstall)) 1232 if (!(installer_state.is_msi() && is_uninstall))
1209 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1233 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1210 // to pass through, since this is only returned on uninstall which is 1234 // to pass through, since this is only returned on uninstall which is
1211 // never invoked directly by Google Update. 1235 // never invoked directly by Google Update.
1212 return_code = InstallUtil::GetInstallReturnCode(install_status); 1236 return_code = InstallUtil::GetInstallReturnCode(install_status);
1213 1237
1214 VLOG(1) << "Installation complete, returning: " << return_code; 1238 VLOG(1) << "Installation complete, returning: " << return_code;
1215 1239
1216 return return_code; 1240 return return_code;
1217 } 1241 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.cc ('k') | chrome/installer/setup/uninstall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698