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

Unified Diff: chrome/browser/shell_integration_win.cc

Issue 1428833002: Register chrome as a browser when setting the default browser in Win 10 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/shell_integration_win.cc
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 4089dc47a12765898c4a3413352e26cabed14faf..b26a1c2d4d95694844893258a04cdd9a6b17b20f 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -285,6 +285,18 @@ bool IsAsyncSetAsDefaultEnabled() {
return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
}
+bool RegisterBrowser() {
+ base::FilePath chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+ NOTREACHED() << "Error getting app exe path";
+ return false;
+ }
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+
+ return ShellUtil::RegisterChromeBrowser(dist, chrome_exe, base::string16(),
+ true);
+}
+
} // namespace
// static
@@ -655,7 +667,7 @@ bool ShellIntegration::DefaultBrowserWorker::InitializeSetAsDefault() {
// default browser. This is the workaround:
// 1. Unregister the default browser.
// 2. Open "How to make Chrome my default browser" link with openwith.exe.
- // 3. Windows will prompt the user with "How would you link to open this?".
+ // 3. Windows will prompt the user with "How would you like to open this?".
// 4. If Chrome is selected, we intercept the attempt to open the URL and
// instead call OnSetAsDefaultAttemptComplete(), passing true to indicate
// success.
@@ -705,6 +717,11 @@ void ShellIntegration::DefaultBrowserWorker::FinalizeSetAsDefault() {
bool ShellIntegration::DefaultBrowserWorker::SetAsDefaultBrowserAsynchronous() {
DCHECK(IsSetAsDefaultAsynchronous());
+ // Registers chrome.exe as a browser on Windows to make sure it will be shown
+ // in the "How would you like to open this?" prompt.
+ if (!RegisterBrowser())
+ return false;
+
ResetDefaultBrowser();
base::CommandLine cmdline(base::FilePath(L"openwith.exe"));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698