Index: mojo/public/cpp/bindings/interface.h |
diff --git a/mojo/public/cpp/bindings/interface.h b/mojo/public/cpp/bindings/interface.h |
index bba8fef89fc685b0f6b46841363450f5cb321009..ff6bf36a4267e7669380bb2a97af1ef433fcafbc 100644 |
--- a/mojo/public/cpp/bindings/interface.h |
+++ b/mojo/public/cpp/bindings/interface.h |
@@ -63,6 +63,16 @@ struct Interface<mojo::NoInterface> { |
typedef ScopedMessagePipeHandle ScopedHandle; |
}; |
+// Use to convert from a ScopedMessagePipeHandle to an scoped interface |
+// handle. For example, |
+// ConvertToInterface<OmniboxPage>(message_pip_handle.Pass()), |
vtl
2014/04/03 14:58:30
drive-by nit: message_pip -> message_pipe
|
+// where OmniboxPage names an interface in a mojom file. |
+template <typename S> |
+typename Interface<S>::ScopedHandle ConvertToInterface( |
+ ScopedMessagePipeHandle message_pipe_handle) { |
+ return Interface<S>::ScopedHandle( |
+ Interface<S>::Handle(message_pipe_handle.release().value())); |
+} |
// InterfacePipe<S,P> is used to construct a MessagePipe with typed interfaces |
// on either end. |