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

Unified 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 in response to comments. 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 side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698