| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "content/public/test/test_mojo_service.mojom.h" | 11 #include "content/public/test/test_mojo_service.mojom.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "services/shell/public/cpp/interface_factory.h" | 13 #include "services/shell/public/cpp/interface_factory.h" |
| 12 #include "services/shell/public/cpp/shell_client.h" | 14 #include "services/shell/public/cpp/shell_client.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 extern const char kTestMojoAppUrl[]; | 18 extern const char kTestMojoAppUrl[]; |
| 17 | 19 |
| 18 // Simple Mojo app which provides a mojom::TestMojoService impl. The app | 20 // Simple Mojo app which provides a mojom::TestMojoService impl. The app |
| 19 // terminates itself after its TestService fulfills a single DoSomething call. | 21 // terminates itself after its TestService fulfills a single DoSomething call. |
| 20 class TestMojoApp : public shell::ShellClient, | 22 class TestMojoApp : public shell::ShellClient, |
| 21 public shell::InterfaceFactory<mojom::TestMojoService>, | 23 public shell::InterfaceFactory<mojom::TestMojoService>, |
| 22 public mojom::TestMojoService { | 24 public mojom::TestMojoService { |
| 23 public: | 25 public: |
| 24 TestMojoApp(); | 26 TestMojoApp(); |
| 25 ~TestMojoApp() override; | 27 ~TestMojoApp() override; |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 // shell::ShellClient: | 30 // shell::ShellClient: |
| 29 bool AcceptConnection(shell::Connection* connection) override; | 31 bool AcceptConnection(shell::Connection* connection) override; |
| 30 | 32 |
| 31 // shell::InterfaceFactory<mojom::TestMojoService>: | 33 // shell::InterfaceFactory<mojom::TestMojoService>: |
| 32 void Create(shell::Connection* connection, | 34 void Create(shell::Connection* connection, |
| 33 mojo::InterfaceRequest<mojom::TestMojoService> request) override; | 35 mojo::InterfaceRequest<mojom::TestMojoService> request) override; |
| 34 | 36 |
| 35 // TestMojoService: | 37 // TestMojoService: |
| 36 void DoSomething(const DoSomethingCallback& callback) override; | 38 void DoSomething(const DoSomethingCallback& callback) override; |
| 39 void DoTerminateProcess(const DoTerminateProcessCallback& callback) override; |
| 40 void CreateFolder(const CreateFolderCallback& callback) override; |
| 37 void GetRequestorName(const GetRequestorNameCallback& callback) override; | 41 void GetRequestorName(const GetRequestorNameCallback& callback) override; |
| 38 | 42 |
| 39 mojo::Binding<mojom::TestMojoService> service_binding_; | 43 mojo::Binding<mojom::TestMojoService> service_binding_; |
| 40 | 44 |
| 41 // The name of the app connecting to us. | 45 // The name of the app connecting to us. |
| 42 std::string requestor_name_; | 46 std::string requestor_name_; |
| 43 | 47 |
| 44 DISALLOW_COPY_AND_ASSIGN(TestMojoApp); | 48 DISALLOW_COPY_AND_ASSIGN(TestMojoApp); |
| 45 }; | 49 }; |
| 46 | 50 |
| 47 } // namespace | 51 } // namespace content |
| 48 | 52 |
| 49 #endif // CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ | 53 #endif // CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ |
| OLD | NEW |