OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_COMMON_BIND_INTERFACE_HELPERS_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_BIND_INTERFACE_HELPERS_H_ |
| 7 |
| 8 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| 9 #include "mojo/public/cpp/bindings/interface_request.h" |
| 10 #include "mojo/public/cpp/system/message_pipe.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 template <typename Host, typename Interface> |
| 15 void BindInterface(Host* host, mojo::InterfacePtr<Interface>* ptr) { |
| 16 mojo::MessagePipe pipe; |
| 17 ptr->Bind(mojo::InterfacePtrInfo<Interface>(std::move(pipe.handle0), 0u)); |
| 18 host->BindInterface(Interface::Name_, std::move(pipe.handle1)); |
| 19 } |
| 20 template <typename Host, typename Interface> |
| 21 void BindInterface(Host* host, mojo::InterfaceRequest<Interface> request) { |
| 22 host->BindInterface(Interface::Name_, std::move(request.PassMessagePipe())); |
| 23 } |
| 24 |
| 25 } // namespace |
| 26 |
| 27 #endif // CONTENT_PUBLIC_COMMON_BIND_INTERFACE_HELPERS_H_ |
OLD | NEW |