Index: mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/FactoryInternal.java |
diff --git a/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/FactoryInternal.java b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/FactoryInternal.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4dbc7879f0272621d81818aff77789554a583d4e |
--- /dev/null |
+++ b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/FactoryInternal.java |
@@ -0,0 +1,541 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// This file is autogenerated by: |
+// mojo/public/tools/bindings/mojom_bindings_generator.py |
+// For: |
+// mojo/public/interfaces/bindings/tests/sample_factory.mojom |
+// |
+ |
+package org.chromium.mojo.bindings.test.mojom.sample; |
+ |
+class FactoryInternal { |
+ |
+ public static final org.chromium.mojo.bindings.InterfaceWithClient.Builder<FactoryClient, Factory, Factory.Proxy> BUILDER = |
+ new org.chromium.mojo.bindings.InterfaceWithClient.Builder<FactoryClient, Factory, Factory.Proxy>() { |
+ |
+ public Proxy buildProxy(org.chromium.mojo.system.Core core, |
+ org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) { |
+ return new Proxy(core, messageReceiver); |
+ } |
+ |
+ public Stub buildStub(org.chromium.mojo.system.Core core, Factory impl) { |
+ return new Stub(core, impl); |
+ } |
+ |
+ public Factory[] newArray(int size) { |
+ return new Factory[size]; |
+ } |
+ |
+ protected org.chromium.mojo.bindings.Interface.Builder<FactoryClient, ?> getClientBuilder() { |
+ return FactoryClient.BUILDER; |
+ } |
+ }; |
+ |
+ private static final int DO_STUFF_ORDINAL = 0; |
+ private static final int DO_STUFF2_ORDINAL = 1; |
+ private static final int CREATE_NAMED_OBJECT_ORDINAL = 2; |
+ private static final int REQUEST_IMPORTED_INTERFACE_ORDINAL = 3; |
+ private static final int TAKE_IMPORTED_INTERFACE_ORDINAL = 4; |
+ |
+ static final class Proxy extends org.chromium.mojo.bindings.InterfaceWithClient.BaseProxy<FactoryClient> implements Factory.Proxy { |
+ |
+ Proxy(org.chromium.mojo.system.Core core, |
+ org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) { |
+ super(core, messageReceiver); |
+ } |
+ |
+ @Override |
+ public void doStuff(Request request, org.chromium.mojo.system.MessagePipeHandle pipe) { |
+ FactoryDoStuffParams message = new FactoryDoStuffParams(); |
+ message.request = request; |
+ message.pipe = pipe; |
+ getMessageReceiver().accept( |
+ message.serializeWithHeader( |
+ getCore(), |
+ new org.chromium.mojo.bindings.MessageHeader(DO_STUFF_ORDINAL))); |
+ } |
+ |
+ @Override |
+ public void doStuff2(org.chromium.mojo.system.DataPipe.ConsumerHandle pipe) { |
+ FactoryDoStuff2Params message = new FactoryDoStuff2Params(); |
+ message.pipe = pipe; |
+ getMessageReceiver().accept( |
+ message.serializeWithHeader( |
+ getCore(), |
+ new org.chromium.mojo.bindings.MessageHeader(DO_STUFF2_ORDINAL))); |
+ } |
+ |
+ @Override |
+ public void createNamedObject(org.chromium.mojo.bindings.InterfaceRequest<NamedObject.Proxy> obj) { |
+ FactoryCreateNamedObjectParams message = new FactoryCreateNamedObjectParams(); |
+ message.obj = obj; |
+ getMessageReceiver().accept( |
+ message.serializeWithHeader( |
+ getCore(), |
+ new org.chromium.mojo.bindings.MessageHeader(CREATE_NAMED_OBJECT_ORDINAL))); |
+ } |
+ |
+ @Override |
+ public void requestImportedInterface(org.chromium.mojo.bindings.InterfaceRequest<org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.Proxy> obj, RequestImportedInterfaceResponse callback) { |
+ FactoryRequestImportedInterfaceParams message = new FactoryRequestImportedInterfaceParams(); |
+ message.obj = obj; |
+ getMessageReceiver().acceptWithResponder( |
+ message.serializeWithHeader( |
+ getCore(), |
+ new org.chromium.mojo.bindings.MessageHeader( |
+ REQUEST_IMPORTED_INTERFACE_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG, |
+ 0)), |
+ new FactoryRequestImportedInterfaceResponseParamsForwardToCallback(callback)); |
+ } |
+ |
+ @Override |
+ public void takeImportedInterface(org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface obj, TakeImportedInterfaceResponse callback) { |
+ FactoryTakeImportedInterfaceParams message = new FactoryTakeImportedInterfaceParams(); |
+ message.obj = obj; |
+ getMessageReceiver().acceptWithResponder( |
+ message.serializeWithHeader( |
+ getCore(), |
+ new org.chromium.mojo.bindings.MessageHeader( |
+ TAKE_IMPORTED_INTERFACE_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG, |
+ 0)), |
+ new FactoryTakeImportedInterfaceResponseParamsForwardToCallback(callback)); |
+ } |
+ |
+ } |
+ |
+ static final class Stub extends org.chromium.mojo.bindings.Interface.Stub<Factory> { |
+ |
+ Stub(org.chromium.mojo.system.Core core, Factory impl) { |
+ super(core, impl); |
+ } |
+ |
+ @Override |
+ public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) { |
+ try { |
+ org.chromium.mojo.bindings.MessageHeader header = message.getHeader(); |
+ switch(header.getType()) { |
+ case DO_STUFF_ORDINAL: { |
+ if (!header.validateHeader(0)) { |
+ return false; |
+ } |
+ FactoryDoStuffParams data = |
+ FactoryDoStuffParams.deserialize(message.getPayload()); |
+ getImpl().doStuff(data.request, data.pipe); |
+ return true; |
+ } |
+ case DO_STUFF2_ORDINAL: { |
+ if (!header.validateHeader(0)) { |
+ return false; |
+ } |
+ FactoryDoStuff2Params data = |
+ FactoryDoStuff2Params.deserialize(message.getPayload()); |
+ getImpl().doStuff2(data.pipe); |
+ return true; |
+ } |
+ case CREATE_NAMED_OBJECT_ORDINAL: { |
+ if (!header.validateHeader(0)) { |
+ return false; |
+ } |
+ FactoryCreateNamedObjectParams data = |
+ FactoryCreateNamedObjectParams.deserialize(message.getPayload()); |
+ getImpl().createNamedObject(data.obj); |
+ return true; |
+ } |
+ } |
+ } catch (org.chromium.mojo.bindings.DeserializationException e) { |
+ } |
+ return false; |
+ } |
+ |
+ @Override |
+ public boolean acceptWithResponder(org.chromium.mojo.bindings.MessageWithHeader message, org.chromium.mojo.bindings.MessageReceiver receiver) { |
+ try { |
+ org.chromium.mojo.bindings.MessageHeader header = message.getHeader(); |
+ switch(header.getType()) { |
+ case REQUEST_IMPORTED_INTERFACE_ORDINAL: { |
+ if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) { |
+ return false; |
+ } |
+ FactoryRequestImportedInterfaceParams data = |
+ FactoryRequestImportedInterfaceParams.deserialize(message.getPayload()); |
+ getImpl().requestImportedInterface(data.obj, new FactoryRequestImportedInterfaceResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId())); |
+ return true; |
+ } |
+ case TAKE_IMPORTED_INTERFACE_ORDINAL: { |
+ if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) { |
+ return false; |
+ } |
+ FactoryTakeImportedInterfaceParams data = |
+ FactoryTakeImportedInterfaceParams.deserialize(message.getPayload()); |
+ getImpl().takeImportedInterface(data.obj, new FactoryTakeImportedInterfaceResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId())); |
+ return true; |
+ } |
+ } |
+ } catch (org.chromium.mojo.bindings.DeserializationException e) { |
+ } |
+ return false; |
+ } |
+ } |
+ |
+ static final class FactoryDoStuffParams extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 24; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 2); |
+ |
+ public Request request; |
+ public org.chromium.mojo.system.MessagePipeHandle pipe; |
+ |
+ public FactoryDoStuffParams() { |
+ super(STRUCT_SIZE); |
+ pipe = org.chromium.mojo.system.InvalidHandle.INSTANCE; |
+ } |
+ |
+ public static FactoryDoStuffParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static FactoryDoStuffParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ FactoryDoStuffParams result = new FactoryDoStuffParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8); |
+ result.request = Request.decode(decoder1); |
+ } |
+ if (mainDataHeader.numFields > 1) { |
+ result.pipe = decoder0.readMessagePipeHandle(16); |
+ } |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ encoder0.encode(request, 8); |
+ encoder0.encode(pipe, 16); |
+ } |
+ } |
+ |
+ static final class FactoryDoStuff2Params extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 16; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1); |
+ |
+ public org.chromium.mojo.system.DataPipe.ConsumerHandle pipe; |
+ |
+ public FactoryDoStuff2Params() { |
+ super(STRUCT_SIZE); |
+ pipe = org.chromium.mojo.system.InvalidHandle.INSTANCE; |
+ } |
+ |
+ public static FactoryDoStuff2Params deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static FactoryDoStuff2Params decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ FactoryDoStuff2Params result = new FactoryDoStuff2Params(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.pipe = decoder0.readConsumerHandle(8); |
+ } |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ encoder0.encode(pipe, 8); |
+ } |
+ } |
+ |
+ static final class FactoryCreateNamedObjectParams extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 16; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1); |
+ |
+ public org.chromium.mojo.bindings.InterfaceRequest<NamedObject.Proxy> obj; |
+ |
+ public FactoryCreateNamedObjectParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static FactoryCreateNamedObjectParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static FactoryCreateNamedObjectParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ FactoryCreateNamedObjectParams result = new FactoryCreateNamedObjectParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.obj = decoder0.readInterfaceRequest(8); |
+ } |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ encoder0.encode(obj, 8); |
+ } |
+ } |
+ |
+ static final class FactoryRequestImportedInterfaceParams extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 16; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1); |
+ |
+ public org.chromium.mojo.bindings.InterfaceRequest<org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.Proxy> obj; |
+ |
+ public FactoryRequestImportedInterfaceParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static FactoryRequestImportedInterfaceParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static FactoryRequestImportedInterfaceParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ FactoryRequestImportedInterfaceParams result = new FactoryRequestImportedInterfaceParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.obj = decoder0.readInterfaceRequest(8); |
+ } |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ encoder0.encode(obj, 8); |
+ } |
+ } |
+ |
+ static final class FactoryRequestImportedInterfaceResponseParams extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 16; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1); |
+ |
+ public org.chromium.mojo.bindings.InterfaceRequest<org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.Proxy> obj; |
+ |
+ public FactoryRequestImportedInterfaceResponseParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static FactoryRequestImportedInterfaceResponseParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static FactoryRequestImportedInterfaceResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ FactoryRequestImportedInterfaceResponseParams result = new FactoryRequestImportedInterfaceResponseParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.obj = decoder0.readInterfaceRequest(8); |
+ } |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ encoder0.encode(obj, 8); |
+ } |
+ } |
+ |
+ static class FactoryRequestImportedInterfaceResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable |
+ implements org.chromium.mojo.bindings.MessageReceiver { |
+ private final Factory.RequestImportedInterfaceResponse mCallback; |
+ |
+ FactoryRequestImportedInterfaceResponseParamsForwardToCallback(Factory.RequestImportedInterfaceResponse callback) { |
+ this.mCallback = callback; |
+ } |
+ |
+ @Override |
+ public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) { |
+ try { |
+ org.chromium.mojo.bindings.MessageHeader header = message.getHeader(); |
+ if (!header.validateHeader(REQUEST_IMPORTED_INTERFACE_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) { |
+ return false; |
+ } |
+ FactoryRequestImportedInterfaceResponseParams response = FactoryRequestImportedInterfaceResponseParams.deserialize(message.getPayload()); |
+ mCallback.call(response.obj); |
+ return true; |
+ } catch (org.chromium.mojo.bindings.DeserializationException e) { |
+ return false; |
+ } |
+ } |
+ } |
+ |
+ static class FactoryRequestImportedInterfaceResponseParamsProxyToResponder implements Factory.RequestImportedInterfaceResponse { |
+ |
+ private final org.chromium.mojo.system.Core mCore; |
+ private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver; |
+ private final long mRequestId; |
+ |
+ FactoryRequestImportedInterfaceResponseParamsProxyToResponder( |
+ org.chromium.mojo.system.Core core, |
+ org.chromium.mojo.bindings.MessageReceiver messageReceiver, |
+ long requestId) { |
+ mCore = core; |
+ mMessageReceiver = messageReceiver; |
+ mRequestId = requestId; |
+ } |
+ |
+ @Override |
+ public void call(org.chromium.mojo.bindings.InterfaceRequest<org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.Proxy> obj) { |
+ FactoryRequestImportedInterfaceResponseParams response = new FactoryRequestImportedInterfaceResponseParams(); |
+ response.obj = obj; |
+ org.chromium.mojo.bindings.MessageWithHeader message = |
+ response.serializeWithHeader( |
+ mCore, |
+ new org.chromium.mojo.bindings.MessageHeader( |
+ REQUEST_IMPORTED_INTERFACE_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG, |
+ mRequestId)); |
+ mMessageReceiver.accept(message); |
+ } |
+ } |
+ |
+ static final class FactoryTakeImportedInterfaceParams extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 16; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1); |
+ |
+ public org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface obj; |
+ |
+ public FactoryTakeImportedInterfaceParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static FactoryTakeImportedInterfaceParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static FactoryTakeImportedInterfaceParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ FactoryTakeImportedInterfaceParams result = new FactoryTakeImportedInterfaceParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.obj = decoder0.readServiceInterface(8, org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.BUILDER); |
+ } |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ encoder0.encode(obj, 8, org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.BUILDER); |
+ } |
+ } |
+ |
+ static final class FactoryTakeImportedInterfaceResponseParams extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 16; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1); |
+ |
+ public org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface obj; |
+ |
+ public FactoryTakeImportedInterfaceResponseParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static FactoryTakeImportedInterfaceResponseParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static FactoryTakeImportedInterfaceResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ FactoryTakeImportedInterfaceResponseParams result = new FactoryTakeImportedInterfaceResponseParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.obj = decoder0.readServiceInterface(8, org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.BUILDER); |
+ } |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ encoder0.encode(obj, 8, org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface.BUILDER); |
+ } |
+ } |
+ |
+ static class FactoryTakeImportedInterfaceResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable |
+ implements org.chromium.mojo.bindings.MessageReceiver { |
+ private final Factory.TakeImportedInterfaceResponse mCallback; |
+ |
+ FactoryTakeImportedInterfaceResponseParamsForwardToCallback(Factory.TakeImportedInterfaceResponse callback) { |
+ this.mCallback = callback; |
+ } |
+ |
+ @Override |
+ public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) { |
+ try { |
+ org.chromium.mojo.bindings.MessageHeader header = message.getHeader(); |
+ if (!header.validateHeader(TAKE_IMPORTED_INTERFACE_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) { |
+ return false; |
+ } |
+ FactoryTakeImportedInterfaceResponseParams response = FactoryTakeImportedInterfaceResponseParams.deserialize(message.getPayload()); |
+ mCallback.call(response.obj); |
+ return true; |
+ } catch (org.chromium.mojo.bindings.DeserializationException e) { |
+ return false; |
+ } |
+ } |
+ } |
+ |
+ static class FactoryTakeImportedInterfaceResponseParamsProxyToResponder implements Factory.TakeImportedInterfaceResponse { |
+ |
+ private final org.chromium.mojo.system.Core mCore; |
+ private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver; |
+ private final long mRequestId; |
+ |
+ FactoryTakeImportedInterfaceResponseParamsProxyToResponder( |
+ org.chromium.mojo.system.Core core, |
+ org.chromium.mojo.bindings.MessageReceiver messageReceiver, |
+ long requestId) { |
+ mCore = core; |
+ mMessageReceiver = messageReceiver; |
+ mRequestId = requestId; |
+ } |
+ |
+ @Override |
+ public void call(org.chromium.mojo.bindings.test.mojom.imported.ImportedInterface obj) { |
+ FactoryTakeImportedInterfaceResponseParams response = new FactoryTakeImportedInterfaceResponseParams(); |
+ response.obj = obj; |
+ org.chromium.mojo.bindings.MessageWithHeader message = |
+ response.serializeWithHeader( |
+ mCore, |
+ new org.chromium.mojo.bindings.MessageHeader( |
+ TAKE_IMPORTED_INTERFACE_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG, |
+ mRequestId)); |
+ mMessageReceiver.accept(message); |
+ } |
+ } |
+ |
+} |
+ |