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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
10 #include "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 }; | 94 }; |
95 | 95 |
96 class HumanResourceSystemServer | 96 class HumanResourceSystemServer |
97 : public ShellClient, | 97 : public ShellClient, |
98 public InterfaceFactory<HumanResourceDatabase> { | 98 public InterfaceFactory<HumanResourceDatabase> { |
99 public: | 99 public: |
100 HumanResourceSystemServer() {} | 100 HumanResourceSystemServer() {} |
101 | 101 |
102 // mojo::ShellClient implementation. | 102 // mojo::ShellClient implementation. |
103 bool AcceptConnection(Connection* connection) override { | 103 bool AcceptConnection(Connection* connection) override { |
104 connection->AddService<HumanResourceDatabase>(this); | 104 connection->AddInterface<HumanResourceDatabase>(this); |
105 return true; | 105 return true; |
106 } | 106 } |
107 | 107 |
108 // InterfaceFactory<HumanResourceDatabase> implementation. | 108 // InterfaceFactory<HumanResourceDatabase> implementation. |
109 void Create(Connection* connection, | 109 void Create(Connection* connection, |
110 InterfaceRequest<HumanResourceDatabase> request) override { | 110 InterfaceRequest<HumanResourceDatabase> request) override { |
111 // It will be deleted automatically when the underlying pipe encounters a | 111 // It will be deleted automatically when the underlying pipe encounters a |
112 // connection error. | 112 // connection error. |
113 new HumanResourceDatabaseImpl(request.Pass()); | 113 new HumanResourceDatabaseImpl(request.Pass()); |
114 } | 114 } |
115 }; | 115 }; |
116 | 116 |
117 } // namespace versioning | 117 } // namespace versioning |
118 } // namespace test | 118 } // namespace test |
119 } // namespace mojo | 119 } // namespace mojo |
120 | 120 |
121 MojoResult MojoMain(MojoHandle request) { | 121 MojoResult MojoMain(MojoHandle request) { |
122 mojo::ApplicationRunner runner( | 122 mojo::ApplicationRunner runner( |
123 new mojo::test::versioning::HumanResourceSystemServer()); | 123 new mojo::test::versioning::HumanResourceSystemServer()); |
124 | 124 |
125 return runner.Run(request); | 125 return runner.Run(request); |
126 } | 126 } |
OLD | NEW |