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 |