Fix registerProtocolHandler OS registration on Windows 8
On Windows 8 to register as the default handler for a protocol you need to go through a Windows shell UI flow, it cannot be done anymore via the IApplicationAssociationRegistration interface.
BUG=150850
TEST=Ensure gmail and other protocol handlers can be registered successfully on Windows 7 and 8.
Review URL: https://chromiumcodereview.appspot.com/10963004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158612 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 4782a3c..27b9212 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -430,7 +430,7 @@
return false;
}
- string16 wprotocol = UTF8ToUTF16(protocol);
+ string16 wprotocol(UTF8ToUTF16(protocol));
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
if (!ShellUtil::MakeChromeDefaultProtocolClient(dist, chrome_exe.value(),
wprotocol)) {
@@ -456,7 +456,27 @@
return false;
}
- VLOG(1) << "Set-as-default Windows UI triggered.";
+ VLOG(1) << "Set-default-browser Windows UI completed.";
+ return true;
+}
+
+bool ShellIntegration::SetAsDefaultProtocolClientInteractive(
+ const std::string& protocol) {
+ FilePath chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+ NOTREACHED() << "Error getting app exe path";
+ return false;
+ }
+
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ string16 wprotocol(UTF8ToUTF16(protocol));
+ if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(
+ dist, chrome_exe.value(), wprotocol)) {
+ LOG(ERROR) << "Failed to launch the set-default-client Windows UI.";
+ return false;
+ }
+
+ VLOG(1) << "Set-default-client Windows UI completed.";
return true;
}