Chromium Code Reviews| Index: chrome/browser/shell_integration.cc |
| diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc |
| index 43b6dbc0f7b12996f3932b5154e54771661f3e3d..562b0c8213a5a883ad95e7a18a08bf296462dfde 100644 |
| --- a/chrome/browser/shell_integration.cc |
| +++ b/chrome/browser/shell_integration.cc |
| @@ -45,6 +45,11 @@ bool SetAsDefaultBrowserInteractive() { |
| return false; |
| } |
| +void SetAsDefaultBrowserUsingSystemSettings( |
| + base::Closure on_finished_callback) { |
| + NOTREACHED(); |
| +} |
|
grt (UTC plus 2)
2016/03/29 16:45:02
should this also:
on_finished_callback.Run();
si
Patrick Monette
2016/03/29 17:43:08
Done.
|
| + |
| bool SetAsDefaultProtocolClientInteractive(const std::string& protocol) { |
| return false; |
| } |
| @@ -187,8 +192,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 +244,8 @@ DefaultWebClientState DefaultBrowserWorker::CheckIsDefaultImpl() { |
| return GetDefaultBrowser(); |
| } |
| -void DefaultBrowserWorker::SetAsDefaultImpl() { |
| +void DefaultBrowserWorker::SetAsDefaultImpl( |
| + base::Closure on_finished_callback) { |
| switch (CanSetAsDefaultBrowser()) { |
| case SET_DEFAULT_NOT_ALLOWED: |
| NOTREACHED(); |
| @@ -249,7 +257,15 @@ void DefaultBrowserWorker::SetAsDefaultImpl() { |
| if (interactive_permitted_) |
| SetAsDefaultBrowserInteractive(); |
| break; |
| +#if defined(OS_WIN) |
|
grt (UTC plus 2)
2016/03/29 16:45:02
can this not be removed? i think it's nice to redu
Patrick Monette
2016/03/29 17:43:08
Done.
|
| + case SET_DEFAULT_OPEN_SETTINGS: |
| + if (interactive_permitted_) { |
| + SetAsDefaultBrowserUsingSystemSettings(on_finished_callback); |
| + return; |
| + } |
| +#endif // defined(OS_WIN) |
| } |
| + on_finished_callback.Run(); |
| } |
| /////////////////////////////////////////////////////////////////////////////// |
| @@ -274,7 +290,8 @@ DefaultWebClientState DefaultProtocolClientWorker::CheckIsDefaultImpl() { |
| return IsDefaultProtocolClient(protocol_); |
| } |
| -void DefaultProtocolClientWorker::SetAsDefaultImpl() { |
| +void DefaultProtocolClientWorker::SetAsDefaultImpl( |
| + base::Closure on_finished_callback) { |
| switch (CanSetAsDefaultProtocolClient()) { |
| case SET_DEFAULT_NOT_ALLOWED: |
| // Not allowed, do nothing. |
| @@ -283,11 +300,15 @@ void DefaultProtocolClientWorker::SetAsDefaultImpl() { |
| SetAsDefaultProtocolClient(protocol_); |
| break; |
| case SET_DEFAULT_INTERACTIVE: |
| - if (interactive_permitted_) { |
| +#if defined(OS_WIN) |
| + case SET_DEFAULT_OPEN_SETTINGS: |
| +// TODO(pmonette): Implement this for Windows 10. |
| +#endif // defined(OS_WIN) |
| + if (interactive_permitted_) |
| SetAsDefaultProtocolClientInteractive(protocol_); |
| - } |
| break; |
| } |
| + on_finished_callback.Run(); |
| } |
| } // namespace shell_integration |