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

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: Refactoring of the helper class Created 4 years, 9 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..6ffe3be19a323d2d4e7fa08841894bea494f6f20 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -45,6 +45,12 @@ bool SetAsDefaultBrowserInteractive() {
return false;
}
+void SetAsDefaultBrowserUsingSystemSettings(
+ const base::Closure& on_finished_callback) {
+ NOTREACHED();
+ on_finished_callback.Run();
+}
+
bool SetAsDefaultProtocolClientInteractive(const std::string& protocol) {
return false;
}
@@ -187,8 +193,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 +245,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 +258,13 @@ void DefaultBrowserWorker::SetAsDefaultImpl() {
if (interactive_permitted_)
SetAsDefaultBrowserInteractive();
break;
+ case SET_DEFAULT_OPEN_SETTINGS:
+ if (interactive_permitted_) {
+ SetAsDefaultBrowserUsingSystemSettings(on_finished_callback);
+ return;
+ }
}
+ on_finished_callback.Run();
}
///////////////////////////////////////////////////////////////////////////////
@@ -274,7 +289,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 +299,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