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 #include <map> | 5 #include <map> |
6 #include <memory> | 6 #include <memory> |
7 | 7 |
8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
9 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 std::map<uint64_t, EmployeeInfo*> employees_; | 90 std::map<uint64_t, EmployeeInfo*> employees_; |
91 | 91 |
92 StrongBinding<HumanResourceDatabase> strong_binding_; | 92 StrongBinding<HumanResourceDatabase> strong_binding_; |
93 }; | 93 }; |
94 | 94 |
95 class HumanResourceSystemServer : public ApplicationDelegate { | 95 class HumanResourceSystemServer : public ApplicationDelegate { |
96 public: | 96 public: |
97 HumanResourceSystemServer() {} | 97 HumanResourceSystemServer() {} |
98 | 98 |
99 // ApplicationDelegate implementation. | 99 // ApplicationDelegate implementation. |
100 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 100 bool ConfigureIncomingConnection( |
101 connection->GetServiceProviderImpl().AddService<HumanResourceDatabase>( | 101 ServiceProviderImpl* service_provider_impl) override { |
| 102 service_provider_impl->AddService<HumanResourceDatabase>( |
102 [](const ConnectionContext& connection_context, | 103 [](const ConnectionContext& connection_context, |
103 InterfaceRequest<HumanResourceDatabase> hr_db_request) { | 104 InterfaceRequest<HumanResourceDatabase> hr_db_request) { |
104 // It will be deleted automatically when the underlying pipe | 105 // It will be deleted automatically when the underlying pipe |
105 // encounters a connection error. | 106 // encounters a connection error. |
106 new HumanResourceDatabaseImpl(hr_db_request.Pass()); | 107 new HumanResourceDatabaseImpl(hr_db_request.Pass()); |
107 }); | 108 }); |
108 return true; | 109 return true; |
109 } | 110 } |
110 }; | 111 }; |
111 | 112 |
112 } // namespace versioning | 113 } // namespace versioning |
113 } // namespace test | 114 } // namespace test |
114 } // namespace mojo | 115 } // namespace mojo |
115 | 116 |
116 MojoResult MojoMain(MojoHandle application_request) { | 117 MojoResult MojoMain(MojoHandle application_request) { |
117 mojo::ApplicationRunner runner( | 118 mojo::ApplicationRunner runner( |
118 std::unique_ptr<mojo::test::versioning::HumanResourceSystemServer>( | 119 std::unique_ptr<mojo::test::versioning::HumanResourceSystemServer>( |
119 new mojo::test::versioning::HumanResourceSystemServer())); | 120 new mojo::test::versioning::HumanResourceSystemServer())); |
120 | 121 |
121 return runner.Run(application_request); | 122 return runner.Run(application_request); |
122 } | 123 } |
OLD | NEW |