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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 class HumanResourceSystemServer | 98 class HumanResourceSystemServer |
99 : public service_manager::Service, | 99 : public service_manager::Service, |
100 public InterfaceFactory<HumanResourceDatabase> { | 100 public InterfaceFactory<HumanResourceDatabase> { |
101 public: | 101 public: |
102 HumanResourceSystemServer() { | 102 HumanResourceSystemServer() { |
103 registry_.AddInterface<HumanResourceDatabase>(this); | 103 registry_.AddInterface<HumanResourceDatabase>(this); |
104 } | 104 } |
105 | 105 |
106 // service_manager::Service implementation. | 106 // service_manager::Service implementation. |
107 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 107 void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
108 const std::string& interface_name, | 108 const std::string& interface_name, |
109 mojo::ScopedMessagePipeHandle interface_pipe) override { | 109 mojo::ScopedMessagePipeHandle interface_pipe) override { |
110 registry_.BindInterface(source_info.identity, interface_name, | 110 registry_.BindInterface(source_info.identity, interface_name, |
111 std::move(interface_pipe)); | 111 std::move(interface_pipe)); |
112 } | 112 } |
113 | 113 |
114 // InterfaceFactory<HumanResourceDatabase> implementation. | 114 // InterfaceFactory<HumanResourceDatabase> implementation. |
115 void Create(Connection* connection, | 115 void Create(Connection* connection, |
116 InterfaceRequest<HumanResourceDatabase> request) override { | 116 InterfaceRequest<HumanResourceDatabase> request) override { |
117 // It will be deleted automatically when the underlying pipe encounters a | 117 // It will be deleted automatically when the underlying pipe encounters a |
118 // connection error. | 118 // connection error. |
119 new HumanResourceDatabaseImpl(std::move(request)); | 119 new HumanResourceDatabaseImpl(std::move(request)); |
120 } | 120 } |
121 | 121 |
122 private: | 122 private: |
123 service_manager::BinderRegistry registry_; | 123 service_manager::BinderRegistry registry_; |
124 }; | 124 }; |
125 | 125 |
126 } // namespace versioning | 126 } // namespace versioning |
127 } // namespace test | 127 } // namespace test |
128 } // namespace mojo | 128 } // namespace mojo |
129 | 129 |
130 MojoResult ServiceMain(MojoHandle request) { | 130 MojoResult ServiceMain(MojoHandle request) { |
131 mojo::ServiceRunner runner( | 131 mojo::ServiceRunner runner( |
132 new mojo::test::versioning::HumanResourceSystemServer()); | 132 new mojo::test::versioning::HumanResourceSystemServer()); |
133 | 133 |
134 return runner.Run(request); | 134 return runner.Run(request); |
135 } | 135 } |
OLD | NEW |