| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/guid.h" | 6 #include "base/guid.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "mojo/public/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 state->connection_remote_userid = connection->GetRemoteIdentity().user_id(); | 72 state->connection_remote_userid = connection->GetRemoteIdentity().user_id(); |
| 73 state->connection_remote_id = remote_id; | 73 state->connection_remote_id = remote_id; |
| 74 state->initialize_local_name = identity_.name(); | 74 state->initialize_local_name = identity_.name(); |
| 75 state->initialize_id = id_; | 75 state->initialize_id = id_; |
| 76 state->initialize_userid = identity_.user_id(); | 76 state->initialize_userid = identity_.user_id(); |
| 77 connection->GetInterface(&caller_); | 77 connection->GetInterface(&caller_); |
| 78 caller_->ConnectionAccepted(std::move(state)); | 78 caller_->ConnectionAccepted(std::move(state)); |
| 79 | 79 |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 void ShellConnectionLost() override { |
| 83 if (base::MessageLoop::current() && |
| 84 base::MessageLoop::current()->is_running()) { |
| 85 base::MessageLoop::current()->QuitWhenIdle(); |
| 86 } |
| 87 } |
| 82 | 88 |
| 83 // InterfaceFactory<test::mojom::ConnectTestService>: | 89 // InterfaceFactory<test::mojom::ConnectTestService>: |
| 84 void Create(Connection* connection, | 90 void Create(Connection* connection, |
| 85 test::mojom::ConnectTestServiceRequest request) override { | 91 test::mojom::ConnectTestServiceRequest request) override { |
| 86 bindings_.AddBinding(this, std::move(request)); | 92 bindings_.AddBinding(this, std::move(request)); |
| 87 } | 93 } |
| 88 | 94 |
| 89 // InterfaceFactory<test::mojom::StandaloneApp>: | 95 // InterfaceFactory<test::mojom::StandaloneApp>: |
| 90 void Create(Connection* connection, | 96 void Create(Connection* connection, |
| 91 test::mojom::StandaloneAppRequest request) override { | 97 test::mojom::StandaloneAppRequest request) override { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 223 |
| 218 } // namespace shell | 224 } // namespace shell |
| 219 } // namespace mojo | 225 } // namespace mojo |
| 220 | 226 |
| 221 | 227 |
| 222 MojoResult MojoMain(MojoHandle shell_handle) { | 228 MojoResult MojoMain(MojoHandle shell_handle) { |
| 223 MojoResult rv = mojo::ApplicationRunner( | 229 MojoResult rv = mojo::ApplicationRunner( |
| 224 new mojo::shell::ConnectTestApp).Run(shell_handle); | 230 new mojo::shell::ConnectTestApp).Run(shell_handle); |
| 225 return rv; | 231 return rv; |
| 226 } | 232 } |
| OLD | NEW |