Index: mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java |
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java |
index 225b98a88ce31f7d8a8952e0402830254cfb7761..f7d8afec8a24a8db70d64adade82a9b79a1001d5 100644 |
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java |
+++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/InterfaceWithClient.java |
@@ -6,6 +6,7 @@ package org.chromium.mojo.bindings; |
import org.chromium.mojo.system.Core; |
import org.chromium.mojo.system.MessagePipeHandle; |
+import org.chromium.mojo.system.Pair; |
/** |
* Base class for mojo generated interfaces that have a client. |
@@ -89,6 +90,19 @@ public interface InterfaceWithClient<CI extends Interface> extends Interface { |
} |
/** |
+ * Constructs a new |InterfaceRequest| for the interface. This method returns a Pair where |
+ * the first element is a proxy, and the second element is the request. The proxy can be |
+ * used immediately. |
+ * |
+ * @param client the implementation of the client interface. |
+ */ |
+ public final Pair<P, InterfaceRequest<I>> getInterfaceRequest(Core core, CI client) { |
+ Pair<MessagePipeHandle, MessagePipeHandle> handles = core.createMessagePipe(null); |
+ P proxy = attachProxy(handles.first, client); |
+ return Pair.create(proxy, new InterfaceRequest<I>(handles.second)); |
+ } |
+ |
+ /** |
* Returns a manager for the client inetrafce. |
*/ |
protected abstract Interface.Manager<CI, ?> getClientManager(); |