OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_APPLICATION_PUBLIC_CPP_LIB_INTERFACE_FACTORY_CONNECTOR_H_ | 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_LIB_INTERFACE_FACTORY_CONNECTOR_H_ |
6 #define MOJO_APPLICATION_PUBLIC_CPP_LIB_INTERFACE_FACTORY_CONNECTOR_H_ | 6 #define MOJO_APPLICATION_PUBLIC_CPP_LIB_INTERFACE_FACTORY_CONNECTOR_H_ |
7 | 7 |
| 8 #include <utility> |
| 9 |
8 #include "mojo/application/public/cpp/interface_factory.h" | 10 #include "mojo/application/public/cpp/interface_factory.h" |
9 #include "mojo/application/public/cpp/service_connector.h" | 11 #include "mojo/application/public/cpp/service_connector.h" |
10 #include "mojo/public/cpp/bindings/interface_request.h" | 12 #include "mojo/public/cpp/bindings/interface_request.h" |
11 | 13 |
12 namespace mojo { | 14 namespace mojo { |
13 namespace internal { | 15 namespace internal { |
14 | 16 |
15 template <typename Interface> | 17 template <typename Interface> |
16 class InterfaceFactoryConnector : public ServiceConnector { | 18 class InterfaceFactoryConnector : public ServiceConnector { |
17 public: | 19 public: |
18 explicit InterfaceFactoryConnector(InterfaceFactory<Interface>* factory) | 20 explicit InterfaceFactoryConnector(InterfaceFactory<Interface>* factory) |
19 : factory_(factory) {} | 21 : factory_(factory) {} |
20 ~InterfaceFactoryConnector() override {} | 22 ~InterfaceFactoryConnector() override {} |
21 | 23 |
22 void ConnectToService(ApplicationConnection* application_connection, | 24 void ConnectToService(ApplicationConnection* application_connection, |
23 const std::string& interface_name, | 25 const std::string& interface_name, |
24 ScopedMessagePipeHandle client_handle) override { | 26 ScopedMessagePipeHandle client_handle) override { |
25 factory_->Create(application_connection, | 27 factory_->Create(application_connection, |
26 MakeRequest<Interface>(client_handle.Pass())); | 28 MakeRequest<Interface>(std::move(client_handle))); |
27 } | 29 } |
28 | 30 |
29 private: | 31 private: |
30 InterfaceFactory<Interface>* factory_; | 32 InterfaceFactory<Interface>* factory_; |
31 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceFactoryConnector); | 33 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceFactoryConnector); |
32 }; | 34 }; |
33 | 35 |
34 } // namespace internal | 36 } // namespace internal |
35 } // namespace mojo | 37 } // namespace mojo |
36 | 38 |
37 #endif // MOJO_APPLICATION_PUBLIC_CPP_LIB_INTERFACE_FACTORY_CONNECTOR_H_ | 39 #endif // MOJO_APPLICATION_PUBLIC_CPP_LIB_INTERFACE_FACTORY_CONNECTOR_H_ |
OLD | NEW |