| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/application/public/cpp/application_impl.h" | 5 #include "mojo/application/public/cpp/application_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // If by the time we got the reply from the shell, more requests had come in | 159 // If by the time we got the reply from the shell, more requests had come in |
| 160 // then we don't want to quit the app anymore so we return false. Otherwise | 160 // then we don't want to quit the app anymore so we return false. Otherwise |
| 161 // |quit_requested_| is true so we tell the shell to proceed with the quit. | 161 // |quit_requested_| is true so we tell the shell to proceed with the quit. |
| 162 callback.Run(quit_requested_); | 162 callback.Run(quit_requested_); |
| 163 if (quit_requested_) | 163 if (quit_requested_) |
| 164 QuitNow(); | 164 QuitNow(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void ApplicationImpl::OnConnectionError() { | 167 void ApplicationImpl::OnConnectionError() { |
| 168 base::WeakPtr<ApplicationImpl> ptr(weak_factory_.GetWeakPtr()); | 168 base::WeakPtr<ApplicationImpl> ptr(weak_factory_.GetWeakPtr()); |
| 169 QuitNow(); | 169 |
| 170 // We give the delegate notice first, since it might want to do something on |
| 171 // shell connection errors other than immediate termination of the run |
| 172 // loop. The application might want to continue servicing connections other |
| 173 // than the one to the shell. |
| 174 bool quit_now = delegate_->OnShellConnectionError(); |
| 175 if (quit_now) |
| 176 QuitNow(); |
| 170 if (!ptr) | 177 if (!ptr) |
| 171 return; | 178 return; |
| 172 shell_ = nullptr; | 179 shell_ = nullptr; |
| 173 } | 180 } |
| 174 | 181 |
| 175 } // namespace mojo | 182 } // namespace mojo |
| OLD | NEW |