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

Unified Diff: chrome/browser/shell_integration.cc

Issue 1832853003: DefaultBrowserWorker now fully supports opening the settings for Win10 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment + nits Created 4 years, 8 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/browser/shell_integration.cc
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 43b6dbc0f7b12996f3932b5154e54771661f3e3d..9faa80c713debe27014e0f6ca127d51849dcfe98 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -45,6 +45,13 @@ bool SetAsDefaultBrowserInteractive() {
return false;
}
+void SetAsDefaultBrowserUsingSystemSettings(
+ const base::Closure& on_finished_callback) {
+ // This function should only be called on Windows 10+.
+ NOTREACHED();
+ on_finished_callback.Run();
+}
+
bool SetAsDefaultProtocolClientInteractive(const std::string& protocol) {
return false;
}
@@ -187,8 +194,10 @@ void DefaultWebClientWorker::CheckIsDefault(bool is_following_set_as_default) {
void DefaultWebClientWorker::SetAsDefault() {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- SetAsDefaultImpl();
- CheckIsDefault(true);
+
+ // SetAsDefaultImpl will make sure the callback is executed exactly once.
+ SetAsDefaultImpl(
+ base::Bind(&DefaultWebClientWorker::CheckIsDefault, this, true));
}
void DefaultWebClientWorker::ReportSetDefaultResult(
@@ -237,7 +246,8 @@ DefaultWebClientState DefaultBrowserWorker::CheckIsDefaultImpl() {
return GetDefaultBrowser();
}
-void DefaultBrowserWorker::SetAsDefaultImpl() {
+void DefaultBrowserWorker::SetAsDefaultImpl(
+ const base::Closure& on_finished_callback) {
switch (CanSetAsDefaultBrowser()) {
case SET_DEFAULT_NOT_ALLOWED:
NOTREACHED();
@@ -249,7 +259,14 @@ void DefaultBrowserWorker::SetAsDefaultImpl() {
if (interactive_permitted_)
SetAsDefaultBrowserInteractive();
break;
+ case SET_DEFAULT_OPEN_SETTINGS:
+ if (interactive_permitted_) {
+ SetAsDefaultBrowserUsingSystemSettings(on_finished_callback);
+ return;
+ }
+ break;
}
+ on_finished_callback.Run();
}
///////////////////////////////////////////////////////////////////////////////
@@ -274,7 +291,8 @@ DefaultWebClientState DefaultProtocolClientWorker::CheckIsDefaultImpl() {
return IsDefaultProtocolClient(protocol_);
}
-void DefaultProtocolClientWorker::SetAsDefaultImpl() {
+void DefaultProtocolClientWorker::SetAsDefaultImpl(
+ const base::Closure& on_finished_callback) {
switch (CanSetAsDefaultProtocolClient()) {
case SET_DEFAULT_NOT_ALLOWED:
// Not allowed, do nothing.
@@ -283,11 +301,13 @@ void DefaultProtocolClientWorker::SetAsDefaultImpl() {
SetAsDefaultProtocolClient(protocol_);
break;
case SET_DEFAULT_INTERACTIVE:
- if (interactive_permitted_) {
+ // TODO(pmonette): Implement SET_DEFAULT_OPEN_SETTINGS for Windows 10.
+ case SET_DEFAULT_OPEN_SETTINGS:
+ if (interactive_permitted_)
SetAsDefaultProtocolClientInteractive(protocol_);
- }
break;
}
+ on_finished_callback.Run();
}
} // namespace shell_integration

Powered by Google App Engine
This is Rietveld 408576698