Index: mojo/application/public/cpp/lib/application_impl.cc |
diff --git a/mojo/application/public/cpp/lib/application_impl.cc b/mojo/application/public/cpp/lib/application_impl.cc |
index da27be1c98b568ab6eb29f69bdf5b41944f11ba0..4214a9e6873204092f65f9f6099a84fcba1a483c 100644 |
--- a/mojo/application/public/cpp/lib/application_impl.cc |
+++ b/mojo/application/public/cpp/lib/application_impl.cc |
@@ -166,7 +166,14 @@ void ApplicationImpl::OnQuitRequested(const Callback<void(bool)>& callback) { |
void ApplicationImpl::OnConnectionError() { |
base::WeakPtr<ApplicationImpl> ptr(weak_factory_.GetWeakPtr()); |
- QuitNow(); |
+ |
+ // We give the delegate notice first, since it might want to do something on |
+ // shell connection errors other than immediate termination of the run |
+ // loop. The application might want to continue servicing connections other |
+ // than the one to the shell. |
+ bool quit_now = delegate_->OnShellConnectionError(); |
+ if (quit_now) |
+ QuitNow(); |
if (!ptr) |
return; |
shell_ = nullptr; |