| 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 "mojo/public/c/system/main.h" | 6 #include "mojo/public/c/system/main.h" |
| 7 #include "mojo/public/cpp/bindings/binding_set.h" | 7 #include "mojo/public/cpp/bindings/binding_set.h" |
| 8 #include "services/shell/public/cpp/application_runner.h" | 8 #include "services/shell/public/cpp/application_runner.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/shell_client.h" | 11 #include "services/shell/public/cpp/service.h" |
| 12 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h" | 12 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h" |
| 13 | 13 |
| 14 namespace shell { | 14 namespace shell { |
| 15 | 15 |
| 16 class ShutdownClientApp | 16 class ShutdownClientApp |
| 17 : public ShellClient, | 17 : public Service, |
| 18 public InterfaceFactory<mojom::ShutdownTestClientController>, | 18 public InterfaceFactory<mojom::ShutdownTestClientController>, |
| 19 public mojom::ShutdownTestClientController, | 19 public mojom::ShutdownTestClientController, |
| 20 public mojom::ShutdownTestClient { | 20 public mojom::ShutdownTestClient { |
| 21 public: | 21 public: |
| 22 ShutdownClientApp() {} | 22 ShutdownClientApp() {} |
| 23 ~ShutdownClientApp() override {} | 23 ~ShutdownClientApp() override {} |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 // shell::ShellClient: | 26 // shell::Service: |
| 27 void Initialize(Connector* connector, const Identity& identity, | 27 void OnStart(Connector* connector, const Identity& identity, |
| 28 uint32_t id) override { | 28 uint32_t id) override { |
| 29 connector_ = connector; | 29 connector_ = connector; |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool AcceptConnection(Connection* connection) override { | 32 bool OnConnect(Connection* connection) override { |
| 33 connection->AddInterface<mojom::ShutdownTestClientController>(this); | 33 connection->AddInterface<mojom::ShutdownTestClientController>(this); |
| 34 return true; | 34 return true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // InterfaceFactory<mojom::ShutdownTestClientController>: | 37 // InterfaceFactory<mojom::ShutdownTestClientController>: |
| 38 void Create(Connection* connection, | 38 void Create(Connection* connection, |
| 39 mojom::ShutdownTestClientControllerRequest request) override { | 39 mojom::ShutdownTestClientControllerRequest request) override { |
| 40 bindings_.AddBinding(this, std::move(request)); | 40 bindings_.AddBinding(this, std::move(request)); |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 62 DISALLOW_COPY_AND_ASSIGN(ShutdownClientApp); | 62 DISALLOW_COPY_AND_ASSIGN(ShutdownClientApp); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace shell | 65 } // namespace shell |
| 66 | 66 |
| 67 | 67 |
| 68 MojoResult MojoMain(MojoHandle shell_handle) { | 68 MojoResult MojoMain(MojoHandle shell_handle) { |
| 69 return shell::ApplicationRunner(new shell::ShutdownClientApp) | 69 return shell::ApplicationRunner(new shell::ShutdownClientApp) |
| 70 .Run(shell_handle); | 70 .Run(shell_handle); |
| 71 } | 71 } |
| OLD | NEW |