| 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "mojo/public/cpp/bindings/binding_set.h" | 7 #include "mojo/public/cpp/bindings/binding_set.h" |
| 8 #include "services/shell/public/c/main.h" | 8 #include "services/shell/public/c/main.h" |
| 9 #include "services/shell/public/cpp/connector.h" | 9 #include "services/shell/public/cpp/connector.h" |
| 10 #include "services/shell/public/cpp/interface_factory.h" | 10 #include "services/shell/public/cpp/interface_factory.h" |
| 11 #include "services/shell/public/cpp/interface_registry.h" |
| 11 #include "services/shell/public/cpp/service.h" | 12 #include "services/shell/public/cpp/service.h" |
| 12 #include "services/shell/public/cpp/service_runner.h" | 13 #include "services/shell/public/cpp/service_runner.h" |
| 13 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h" | 14 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h" |
| 14 | 15 |
| 15 namespace shell { | 16 namespace shell { |
| 16 | 17 |
| 17 class ShutdownClientApp | 18 class ShutdownClientApp |
| 18 : public Service, | 19 : public Service, |
| 19 public InterfaceFactory<mojom::ShutdownTestClientController>, | 20 public InterfaceFactory<mojom::ShutdownTestClientController>, |
| 20 public mojom::ShutdownTestClientController, | 21 public mojom::ShutdownTestClientController, |
| 21 public mojom::ShutdownTestClient { | 22 public mojom::ShutdownTestClient { |
| 22 public: | 23 public: |
| 23 ShutdownClientApp() {} | 24 ShutdownClientApp() {} |
| 24 ~ShutdownClientApp() override {} | 25 ~ShutdownClientApp() override {} |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 // shell::Service: | 28 // shell::Service: |
| 28 bool OnConnect(Connection* connection) override { | 29 bool OnConnect(const Identity& remote_identity, |
| 29 connection->AddInterface<mojom::ShutdownTestClientController>(this); | 30 InterfaceRegistry* registry) override { |
| 31 registry->AddInterface<mojom::ShutdownTestClientController>(this); |
| 30 return true; | 32 return true; |
| 31 } | 33 } |
| 32 | 34 |
| 33 // InterfaceFactory<mojom::ShutdownTestClientController>: | 35 // InterfaceFactory<mojom::ShutdownTestClientController>: |
| 34 void Create(const Identity& remote_identity, | 36 void Create(const Identity& remote_identity, |
| 35 mojom::ShutdownTestClientControllerRequest request) override { | 37 mojom::ShutdownTestClientControllerRequest request) override { |
| 36 bindings_.AddBinding(this, std::move(request)); | 38 bindings_.AddBinding(this, std::move(request)); |
| 37 } | 39 } |
| 38 | 40 |
| 39 // mojom::ShutdownTestClientController: | 41 // mojom::ShutdownTestClientController: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 63 DISALLOW_COPY_AND_ASSIGN(ShutdownClientApp); | 65 DISALLOW_COPY_AND_ASSIGN(ShutdownClientApp); |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 } // namespace shell | 68 } // namespace shell |
| 67 | 69 |
| 68 | 70 |
| 69 MojoResult ServiceMain(MojoHandle service_request_handle) { | 71 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 70 shell::ServiceRunner runner(new shell::ShutdownClientApp); | 72 shell::ServiceRunner runner(new shell::ShutdownClientApp); |
| 71 return runner.Run(service_request_handle); | 73 return runner.Run(service_request_handle); |
| 72 } | 74 } |
| OLD | NEW |