Chromium Code Reviews| Index: chrome/installer/setup/setup_main.cc |
| diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc |
| index 15e08477d8f16faf9119d7e38c665825deb21ef1..27569ddbe84d9200314fa6b3adea01a1ac4f71f7 100644 |
| --- a/chrome/installer/setup/setup_main.cc |
| +++ b/chrome/installer/setup/setup_main.cc |
| @@ -832,14 +832,20 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
| GoogleUpdateSettings::SetEULAConsent(*installer_state, true); |
| } else if (cmd_line.HasSwitch( |
| installer::switches::kRegisterChromeBrowser)) { |
| + installer::InstallStatus status = installer::UNKNOWN_STATUS; |
| const Product* chrome_install = |
| installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); |
| if (chrome_install) { |
| // If --register-chrome-browser option is specified, register all |
| - // Chrome protocol/file associations as well as register it as a valid |
| - // browser for Start Menu->Internet shortcut. This option should only |
| - // be used when setup.exe is launched with admin rights. We do not |
| - // make any user specific changes in this option. |
| + // Chrome protocol/file associations, as well as register it as a valid |
| + // browser for Start Menu->Internet shortcut,and also as a valid handler |
| + // for a set of URL protocols that Chrome may become the default handler |
| + // for through website use of registerProtocolHandler. |
| + // 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.
|
| + // the --register-chrome-browser option, as well as also registering |
| + // Chrome as a potential handler for the supplied protocol. |
| + // These options should only be used when setup.exe is launched with admin |
| + // rights. We do not make any user specific changes with this option. |
| std::wstring chrome_exe(cmd_line.GetSwitchValueNative( |
| installer::switches::kRegisterChromeBrowser)); |
| std::wstring suffix; |
| @@ -848,12 +854,22 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
| suffix = cmd_line.GetSwitchValueNative( |
| installer::switches::kRegisterChromeBrowserSuffix); |
| } |
| - *exit_code = ShellUtil::RegisterChromeBrowser( |
| - chrome_install->distribution(), chrome_exe, suffix, false); |
| + if (cmd_line.HasSwitch( |
| + installer::switches::kRegisterURLProtocol)) { |
| + std::wstring protocol = cmd_line.GetSwitchValueNative( |
| + installer::switches::kRegisterURLProtocol); |
| + if (ShellUtil::RegisterChromeForProtocol(chrome_install->distribution(), |
| + chrome_exe, suffix, protocol, false)) |
| + status = installer::IN_USE_UPDATED; |
| + } else { |
| + if (ShellUtil::RegisterChromeBrowser(chrome_install->distribution(), |
| + chrome_exe, suffix, false)) |
| + status = installer::IN_USE_UPDATED; |
| + } |
| } else { |
| LOG(DFATAL) << "Can't register browser - Chrome distribution not found"; |
| - *exit_code = installer::UNKNOWN_STATUS; |
| } |
| + *exit_code = InstallUtil::GetInstallReturnCode(status); |
| } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { |
| // If --rename-chrome-exe is specified, we want to rename the executables |
| // and exit. |