diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 23:52:46 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 23:52:46 +0000 |
commit | b94661f4a8c8dcc048ccd29e34eae6b554880d99 (patch) | |
tree | c5c3f053620d4ce3050cb952db085dea3b4d7647 /chrome/browser/shell_integration_win.cc | |
parent | 6a819340df1daea5d47f247c207610547e659c42 (diff) | |
download | chromium_src-b94661f4a8c8dcc048ccd29e34eae6b554880d99.zip chromium_src-b94661f4a8c8dcc048ccd29e34eae6b554880d99.tar.gz chromium_src-b94661f4a8c8dcc048ccd29e34eae6b554880d99.tar.bz2 |
linux_aura: Enable the extenal protocol dialog.
This refactors all the windows code out of external_protocol_dialog.cc
into the cross-platform ShellIntegration interface, and makes the
external_protocol_dialog.cc implementation use the existing
external_protocol_dialog_delegate.cc interface.
BUG=337660
R=sky@chromium.org
Review URL: https://codereview.chromium.org/132903018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/shell_integration_win.cc')
-rw-r--r-- | chrome/browser/shell_integration_win.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 816cd46..3b8ac54 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -296,11 +296,23 @@ ShellIntegration::DefaultWebClientState base::UTF8ToUTF16(protocol))); } -std::string ShellIntegration::GetApplicationForProtocol(const GURL& url) { - // TODO(calamity): this will be implemented when external_protocol_dialog is - // refactored on windows. - NOTREACHED(); - return std::string(); +base::string16 ShellIntegration::GetApplicationForProtocol(const GURL& url) { + std::wstring url_spec = base::ASCIIToWide(url.possibly_invalid_spec()); + std::wstring cmd_key_path = + base::ASCIIToWide(url.scheme() + "\\shell\\open\\command"); + base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); + size_t split_offset = url_spec.find(L':'); + if (split_offset == std::wstring::npos) + return std::wstring(); + std::wstring parameters = url_spec.substr(split_offset + 1, + url_spec.length() - 1); + std::wstring application_to_launch; + if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) { + ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); + return application_to_launch; + } + + return std::wstring(); } // There is no reliable way to say which browser is default on a machine (each |