OLD | NEW |
---|---|
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 Loading... | |
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,and also as a valid handler |
841 // be used when setup.exe is launched with admin rights. We do not | 842 // for a set of URL protocols that Chrome may become the default handler |
842 // make any user specific changes in this option. | 843 // for through website use of registerProtocolHandler. |
844 // The --register-url-protocol performs the same actions as | |
grt (UTC plus 2)
2011/05/25 14:35:45
Please use good grammar in comments. It's hard to
benwells
2011/05/26 00:23:04
Done.
| |
845 // the --register-chrome-browser option, as well as also registering | |
846 // Chrome as a potential handler for the supplied protocol. | |
847 // These options should only be used when setup.exe is launched with admin | |
848 // rights. We do not make any user specific changes with this option. | |
843 std::wstring chrome_exe(cmd_line.GetSwitchValueNative( | 849 std::wstring chrome_exe(cmd_line.GetSwitchValueNative( |
844 installer::switches::kRegisterChromeBrowser)); | 850 installer::switches::kRegisterChromeBrowser)); |
845 std::wstring suffix; | 851 std::wstring suffix; |
846 if (cmd_line.HasSwitch( | 852 if (cmd_line.HasSwitch( |
847 installer::switches::kRegisterChromeBrowserSuffix)) { | 853 installer::switches::kRegisterChromeBrowserSuffix)) { |
848 suffix = cmd_line.GetSwitchValueNative( | 854 suffix = cmd_line.GetSwitchValueNative( |
849 installer::switches::kRegisterChromeBrowserSuffix); | 855 installer::switches::kRegisterChromeBrowserSuffix); |
850 } | 856 } |
851 *exit_code = ShellUtil::RegisterChromeBrowser( | 857 if (cmd_line.HasSwitch( |
852 chrome_install->distribution(), chrome_exe, suffix, false); | 858 installer::switches::kRegisterURLProtocol)) { |
859 std::wstring protocol = cmd_line.GetSwitchValueNative( | |
860 installer::switches::kRegisterURLProtocol); | |
861 if (ShellUtil::RegisterChromeForProtocol(chrome_install->distribution(), | |
862 chrome_exe, suffix, protocol, false)) | |
863 status = installer::IN_USE_UPDATED; | |
864 } else { | |
865 if (ShellUtil::RegisterChromeBrowser(chrome_install->distribution(), | |
866 chrome_exe, suffix, false)) | |
867 status = installer::IN_USE_UPDATED; | |
868 } | |
853 } else { | 869 } else { |
854 LOG(DFATAL) << "Can't register browser - Chrome distribution not found"; | 870 LOG(DFATAL) << "Can't register browser - Chrome distribution not found"; |
855 *exit_code = installer::UNKNOWN_STATUS; | |
856 } | 871 } |
872 *exit_code = InstallUtil::GetInstallReturnCode(status); | |
857 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { | 873 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { |
858 // If --rename-chrome-exe is specified, we want to rename the executables | 874 // If --rename-chrome-exe is specified, we want to rename the executables |
859 // and exit. | 875 // and exit. |
860 *exit_code = RenameChromeExecutables(original_state, installer_state); | 876 *exit_code = RenameChromeExecutables(original_state, installer_state); |
861 } else if (cmd_line.HasSwitch( | 877 } else if (cmd_line.HasSwitch( |
862 installer::switches::kRemoveChromeRegistration)) { | 878 installer::switches::kRemoveChromeRegistration)) { |
863 // This is almost reverse of --register-chrome-browser option above. | 879 // This is almost reverse of --register-chrome-browser option above. |
864 // Here we delete Chrome browser registration. This option should only | 880 // Here we delete Chrome browser registration. This option should only |
865 // be used when setup.exe is launched with admin rights. We do not | 881 // be used when setup.exe is launched with admin rights. We do not |
866 // make any user specific changes in this option. | 882 // make any user specific changes in this option. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 if (!(installer_state.is_msi() && is_uninstall)) | 1224 if (!(installer_state.is_msi() && is_uninstall)) |
1209 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1225 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1210 // to pass through, since this is only returned on uninstall which is | 1226 // to pass through, since this is only returned on uninstall which is |
1211 // never invoked directly by Google Update. | 1227 // never invoked directly by Google Update. |
1212 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1228 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1213 | 1229 |
1214 VLOG(1) << "Installation complete, returning: " << return_code; | 1230 VLOG(1) << "Installation complete, returning: " << return_code; |
1215 | 1231 |
1216 return return_code; | 1232 return return_code; |
1217 } | 1233 } |
OLD | NEW |