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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "examples/hello_mojo/hello_mojo.mojom.h" | 9 #include "examples/hello_mojo/hello_mojo.mojom.h" |
10 #include "mojo/public/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ~HelloMojoServerApp() override {} | 45 ~HelloMojoServerApp() override {} |
46 | 46 |
47 // |mojo::ApplicationDelegate| implementation: | 47 // |mojo::ApplicationDelegate| implementation: |
48 bool ConfigureIncomingConnection( | 48 bool ConfigureIncomingConnection( |
49 mojo::ApplicationConnection* application_connection) override { | 49 mojo::ApplicationConnection* application_connection) override { |
50 application_connection->AddService<HelloMojo>(this); | 50 application_connection->AddService<HelloMojo>(this); |
51 return true; | 51 return true; |
52 } | 52 } |
53 | 53 |
54 // |mojo::InterfaceFactory<HelloMojo>| implementation: | 54 // |mojo::InterfaceFactory<HelloMojo>| implementation: |
55 void Create(mojo::ApplicationConnection* application_connection, | 55 void Create(const mojo::ConnectionContext& connection_context, |
56 mojo::InterfaceRequest<HelloMojo> hello_mojo_request) override { | 56 mojo::InterfaceRequest<HelloMojo> hello_mojo_request) override { |
57 new HelloMojoImpl(std::move(hello_mojo_request)); // Owns itself. | 57 new HelloMojoImpl(std::move(hello_mojo_request)); // Owns itself. |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 MOJO_DISALLOW_COPY_AND_ASSIGN(HelloMojoServerApp); | 61 MOJO_DISALLOW_COPY_AND_ASSIGN(HelloMojoServerApp); |
62 }; | 62 }; |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 | 65 |
66 MojoResult MojoMain(MojoHandle application_request) { | 66 MojoResult MojoMain(MojoHandle application_request) { |
67 return mojo::ApplicationRunner(std::unique_ptr<mojo::ApplicationDelegate>( | 67 return mojo::ApplicationRunner(std::unique_ptr<mojo::ApplicationDelegate>( |
68 new HelloMojoServerApp())) | 68 new HelloMojoServerApp())) |
69 .Run(application_request); | 69 .Run(application_request); |
70 } | 70 } |
OLD | NEW |