| 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/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
| 10 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 state->connection_remote_userid = connection->GetRemoteUserID(); | 59 state->connection_remote_userid = connection->GetRemoteUserID(); |
| 60 state->connection_remote_id = remote_id; | 60 state->connection_remote_id = remote_id; |
| 61 state->initialize_local_name = name_; | 61 state->initialize_local_name = name_; |
| 62 state->initialize_id = id_; | 62 state->initialize_id = id_; |
| 63 state->initialize_userid = userid_; | 63 state->initialize_userid = userid_; |
| 64 connection->GetInterface(&caller_); | 64 connection->GetInterface(&caller_); |
| 65 caller_->ConnectionAccepted(std::move(state)); | 65 caller_->ConnectionAccepted(std::move(state)); |
| 66 | 66 |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 bool ShellConnectionLost() override { | 69 void ShellConnectionLost() override { |
| 70 if (base::MessageLoop::current() && | 70 if (base::MessageLoop::current() && |
| 71 base::MessageLoop::current()->is_running()) { | 71 base::MessageLoop::current()->is_running()) { |
| 72 base::MessageLoop::current()->QuitWhenIdle(); | 72 base::MessageLoop::current()->QuitWhenIdle(); |
| 73 } | 73 } |
| 74 return true; | |
| 75 } | 74 } |
| 76 | 75 |
| 77 // InterfaceFactory<test::mojom::ConnectTestService>: | 76 // InterfaceFactory<test::mojom::ConnectTestService>: |
| 78 void Create(Connection* connection, | 77 void Create(Connection* connection, |
| 79 test::mojom::ConnectTestServiceRequest request) override { | 78 test::mojom::ConnectTestServiceRequest request) override { |
| 80 bindings_.AddBinding(this, std::move(request)); | 79 bindings_.AddBinding(this, std::move(request)); |
| 81 } | 80 } |
| 82 | 81 |
| 83 // InterfaceFactory<test::mojom::StandaloneApp>: | 82 // InterfaceFactory<test::mojom::StandaloneApp>: |
| 84 void Create(Connection* connection, | 83 void Create(Connection* connection, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 152 |
| 154 } // namespace shell | 153 } // namespace shell |
| 155 } // namespace mojo | 154 } // namespace mojo |
| 156 | 155 |
| 157 | 156 |
| 158 MojoResult MojoMain(MojoHandle shell_handle) { | 157 MojoResult MojoMain(MojoHandle shell_handle) { |
| 159 MojoResult rv = mojo::ApplicationRunner( | 158 MojoResult rv = mojo::ApplicationRunner( |
| 160 new mojo::shell::ConnectTestApp).Run(shell_handle); | 159 new mojo::shell::ConnectTestApp).Run(shell_handle); |
| 161 return rv; | 160 return rv; |
| 162 } | 161 } |
| OLD | NEW |