Index: mojo/dart/packages/mojo_services/lib/mojo/ui/view_manager.mojom.dart |
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_manager.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_manager.mojom.dart |
index 92e814e8a3005954acd5ff134229205a1b61cdba..1a60ca2f621d7384af9994818ab677cebf5a373d 100644 |
--- a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_manager.mojom.dart |
+++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_manager.mojom.dart |
@@ -7,6 +7,7 @@ import 'dart:async'; |
import 'package:mojo/bindings.dart' as bindings; |
import 'package:mojo/core.dart' as core; |
import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as service_describer; |
+import 'package:mojo_services/mojo/ui/view_associates.mojom.dart' as view_associates_mojom; |
import 'package:mojo_services/mojo/ui/view_token.mojom.dart' as view_token_mojom; |
import 'package:mojo_services/mojo/ui/view_trees.mojom.dart' as view_trees_mojom; |
import 'package:mojo_services/mojo/ui/views.mojom.dart' as views_mojom; |
@@ -220,8 +221,295 @@ class _ViewManagerCreateViewTreeParams extends bindings.Struct { |
} |
} |
+ |
+class _ViewManagerRegisterViewAssociateParams extends bindings.Struct { |
+ static const List<bindings.StructDataHeader> kVersions = const [ |
+ const bindings.StructDataHeader(24, 0) |
+ ]; |
+ Object viewAssociate = null; |
+ String label = null; |
+ |
+ _ViewManagerRegisterViewAssociateParams() : super(kVersions.last.size); |
+ |
+ static _ViewManagerRegisterViewAssociateParams deserialize(bindings.Message message) { |
+ var decoder = new bindings.Decoder(message); |
+ var result = decode(decoder); |
+ if (decoder.excessHandles != null) { |
+ decoder.excessHandles.forEach((h) => h.close()); |
+ } |
+ return result; |
+ } |
+ |
+ static _ViewManagerRegisterViewAssociateParams decode(bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ _ViewManagerRegisterViewAssociateParams result = new _ViewManagerRegisterViewAssociateParams(); |
+ |
+ var mainDataHeader = decoder0.decodeStructDataHeader(); |
+ if (mainDataHeader.version <= kVersions.last.version) { |
+ // Scan in reverse order to optimize for more recent versions. |
+ for (int i = kVersions.length - 1; i >= 0; --i) { |
+ if (mainDataHeader.version >= kVersions[i].version) { |
+ if (mainDataHeader.size == kVersions[i].size) { |
+ // Found a match. |
+ break; |
+ } |
+ throw new bindings.MojoCodecError( |
+ 'Header size doesn\'t correspond to known version size.'); |
+ } |
+ } |
+ } else if (mainDataHeader.size < kVersions.last.size) { |
+ throw new bindings.MojoCodecError( |
+ 'Message newer than the last known version cannot be shorter than ' |
+ 'required by the last known version.'); |
+ } |
+ if (mainDataHeader.version >= 0) { |
+ |
+ result.viewAssociate = decoder0.decodeServiceInterface(8, false, view_associates_mojom.ViewAssociateProxy.newFromEndpoint); |
+ } |
+ if (mainDataHeader.version >= 0) { |
+ |
+ result.label = decoder0.decodeString(16, true); |
+ } |
+ return result; |
+ } |
+ |
+ void encode(bindings.Encoder encoder) { |
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
+ try { |
+ encoder0.encodeInterface(viewAssociate, 8, false); |
+ } on bindings.MojoCodecError catch(e) { |
+ e.message = "Error encountered while encoding field " |
+ "viewAssociate of struct _ViewManagerRegisterViewAssociateParams: $e"; |
+ rethrow; |
+ } |
+ try { |
+ encoder0.encodeString(label, 16, true); |
+ } on bindings.MojoCodecError catch(e) { |
+ e.message = "Error encountered while encoding field " |
+ "label of struct _ViewManagerRegisterViewAssociateParams: $e"; |
+ rethrow; |
+ } |
+ } |
+ |
+ String toString() { |
+ return "_ViewManagerRegisterViewAssociateParams(" |
+ "viewAssociate: $viewAssociate" ", " |
+ "label: $label" ")"; |
+ } |
+ |
+ Map toJson() { |
+ throw new bindings.MojoCodecError( |
+ 'Object containing handles cannot be encoded to JSON.'); |
+ } |
+} |
+ |
+ |
+class _ViewManagerRegisterViewAssociateWatcherParams extends bindings.Struct { |
+ static const List<bindings.StructDataHeader> kVersions = const [ |
+ const bindings.StructDataHeader(16, 0) |
+ ]; |
+ Object viewAssociateWatcher = null; |
+ |
+ _ViewManagerRegisterViewAssociateWatcherParams() : super(kVersions.last.size); |
+ |
+ static _ViewManagerRegisterViewAssociateWatcherParams deserialize(bindings.Message message) { |
+ var decoder = new bindings.Decoder(message); |
+ var result = decode(decoder); |
+ if (decoder.excessHandles != null) { |
+ decoder.excessHandles.forEach((h) => h.close()); |
+ } |
+ return result; |
+ } |
+ |
+ static _ViewManagerRegisterViewAssociateWatcherParams decode(bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ _ViewManagerRegisterViewAssociateWatcherParams result = new _ViewManagerRegisterViewAssociateWatcherParams(); |
+ |
+ var mainDataHeader = decoder0.decodeStructDataHeader(); |
+ if (mainDataHeader.version <= kVersions.last.version) { |
+ // Scan in reverse order to optimize for more recent versions. |
+ for (int i = kVersions.length - 1; i >= 0; --i) { |
+ if (mainDataHeader.version >= kVersions[i].version) { |
+ if (mainDataHeader.size == kVersions[i].size) { |
+ // Found a match. |
+ break; |
+ } |
+ throw new bindings.MojoCodecError( |
+ 'Header size doesn\'t correspond to known version size.'); |
+ } |
+ } |
+ } else if (mainDataHeader.size < kVersions.last.size) { |
+ throw new bindings.MojoCodecError( |
+ 'Message newer than the last known version cannot be shorter than ' |
+ 'required by the last known version.'); |
+ } |
+ if (mainDataHeader.version >= 0) { |
+ |
+ result.viewAssociateWatcher = decoder0.decodeServiceInterface(8, false, ViewAssociateWatcherProxy.newFromEndpoint); |
+ } |
+ return result; |
+ } |
+ |
+ void encode(bindings.Encoder encoder) { |
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
+ try { |
+ encoder0.encodeInterface(viewAssociateWatcher, 8, false); |
+ } on bindings.MojoCodecError catch(e) { |
+ e.message = "Error encountered while encoding field " |
+ "viewAssociateWatcher of struct _ViewManagerRegisterViewAssociateWatcherParams: $e"; |
+ rethrow; |
+ } |
+ } |
+ |
+ String toString() { |
+ return "_ViewManagerRegisterViewAssociateWatcherParams(" |
+ "viewAssociateWatcher: $viewAssociateWatcher" ")"; |
+ } |
+ |
+ Map toJson() { |
+ throw new bindings.MojoCodecError( |
+ 'Object containing handles cannot be encoded to JSON.'); |
+ } |
+} |
+ |
+ |
+class _ViewAssociateWatcherOnViewAssociateConnectionErrorParams extends bindings.Struct { |
+ static const List<bindings.StructDataHeader> kVersions = const [ |
+ const bindings.StructDataHeader(16, 0) |
+ ]; |
+ String label = null; |
+ |
+ _ViewAssociateWatcherOnViewAssociateConnectionErrorParams() : super(kVersions.last.size); |
+ |
+ static _ViewAssociateWatcherOnViewAssociateConnectionErrorParams deserialize(bindings.Message message) { |
+ var decoder = new bindings.Decoder(message); |
+ var result = decode(decoder); |
+ if (decoder.excessHandles != null) { |
+ decoder.excessHandles.forEach((h) => h.close()); |
+ } |
+ return result; |
+ } |
+ |
+ static _ViewAssociateWatcherOnViewAssociateConnectionErrorParams decode(bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ _ViewAssociateWatcherOnViewAssociateConnectionErrorParams result = new _ViewAssociateWatcherOnViewAssociateConnectionErrorParams(); |
+ |
+ var mainDataHeader = decoder0.decodeStructDataHeader(); |
+ if (mainDataHeader.version <= kVersions.last.version) { |
+ // Scan in reverse order to optimize for more recent versions. |
+ for (int i = kVersions.length - 1; i >= 0; --i) { |
+ if (mainDataHeader.version >= kVersions[i].version) { |
+ if (mainDataHeader.size == kVersions[i].size) { |
+ // Found a match. |
+ break; |
+ } |
+ throw new bindings.MojoCodecError( |
+ 'Header size doesn\'t correspond to known version size.'); |
+ } |
+ } |
+ } else if (mainDataHeader.size < kVersions.last.size) { |
+ throw new bindings.MojoCodecError( |
+ 'Message newer than the last known version cannot be shorter than ' |
+ 'required by the last known version.'); |
+ } |
+ if (mainDataHeader.version >= 0) { |
+ |
+ result.label = decoder0.decodeString(8, true); |
+ } |
+ return result; |
+ } |
+ |
+ void encode(bindings.Encoder encoder) { |
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
+ try { |
+ encoder0.encodeString(label, 8, true); |
+ } on bindings.MojoCodecError catch(e) { |
+ e.message = "Error encountered while encoding field " |
+ "label of struct _ViewAssociateWatcherOnViewAssociateConnectionErrorParams: $e"; |
+ rethrow; |
+ } |
+ } |
+ |
+ String toString() { |
+ return "_ViewAssociateWatcherOnViewAssociateConnectionErrorParams(" |
+ "label: $label" ")"; |
+ } |
+ |
+ Map toJson() { |
+ Map map = new Map(); |
+ map["label"] = label; |
+ return map; |
+ } |
+} |
+ |
+ |
+class ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams extends bindings.Struct { |
+ static const List<bindings.StructDataHeader> kVersions = const [ |
+ const bindings.StructDataHeader(8, 0) |
+ ]; |
+ |
+ ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams() : super(kVersions.last.size); |
+ |
+ static ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams deserialize(bindings.Message message) { |
+ var decoder = new bindings.Decoder(message); |
+ var result = decode(decoder); |
+ if (decoder.excessHandles != null) { |
+ decoder.excessHandles.forEach((h) => h.close()); |
+ } |
+ return result; |
+ } |
+ |
+ static ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams decode(bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams result = new ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams(); |
+ |
+ var mainDataHeader = decoder0.decodeStructDataHeader(); |
+ if (mainDataHeader.version <= kVersions.last.version) { |
+ // Scan in reverse order to optimize for more recent versions. |
+ for (int i = kVersions.length - 1; i >= 0; --i) { |
+ if (mainDataHeader.version >= kVersions[i].version) { |
+ if (mainDataHeader.size == kVersions[i].size) { |
+ // Found a match. |
+ break; |
+ } |
+ throw new bindings.MojoCodecError( |
+ 'Header size doesn\'t correspond to known version size.'); |
+ } |
+ } |
+ } else if (mainDataHeader.size < kVersions.last.size) { |
+ throw new bindings.MojoCodecError( |
+ 'Message newer than the last known version cannot be shorter than ' |
+ 'required by the last known version.'); |
+ } |
+ return result; |
+ } |
+ |
+ void encode(bindings.Encoder encoder) { |
+ encoder.getStructEncoderAtOffset(kVersions.last); |
+ } |
+ |
+ String toString() { |
+ return "ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams("")"; |
+ } |
+ |
+ Map toJson() { |
+ Map map = new Map(); |
+ return map; |
+ } |
+} |
+ |
const int _viewManagerMethodCreateViewName = 0; |
const int _viewManagerMethodCreateViewTreeName = 1; |
+const int _viewManagerMethodRegisterViewAssociateName = 2; |
+const int _viewManagerMethodRegisterViewAssociateWatcherName = 3; |
class _ViewManagerServiceDescription implements service_describer.ServiceDescription { |
dynamic getTopLevelInterface([Function responseFactory]) => |
@@ -238,6 +526,8 @@ abstract class ViewManager { |
static const String serviceName = "mojo::ui::ViewManager"; |
void createView(Object view, Object viewOwner, Object viewListener, String label); |
void createViewTree(Object viewTree, Object viewTreeListener, String label); |
+ void registerViewAssociate(Object viewAssociate, String label); |
+ void registerViewAssociateWatcher(Object viewAssociateWatcher); |
} |
@@ -325,6 +615,27 @@ class ViewManagerProxy extends bindings.Proxy |
ctrl.sendMessage(params, |
_viewManagerMethodCreateViewTreeName); |
} |
+ void registerViewAssociate(Object viewAssociate, String label) { |
+ if (!ctrl.isBound) { |
+ ctrl.proxyError("The Proxy is closed."); |
+ return; |
+ } |
+ var params = new _ViewManagerRegisterViewAssociateParams(); |
+ params.viewAssociate = viewAssociate; |
+ params.label = label; |
+ ctrl.sendMessage(params, |
+ _viewManagerMethodRegisterViewAssociateName); |
+ } |
+ void registerViewAssociateWatcher(Object viewAssociateWatcher) { |
+ if (!ctrl.isBound) { |
+ ctrl.proxyError("The Proxy is closed."); |
+ return; |
+ } |
+ var params = new _ViewManagerRegisterViewAssociateWatcherParams(); |
+ params.viewAssociateWatcher = viewAssociateWatcher; |
+ ctrl.sendMessage(params, |
+ _viewManagerMethodRegisterViewAssociateWatcherName); |
+ } |
} |
@@ -373,6 +684,16 @@ class ViewManagerStub extends bindings.Stub { |
message.payload); |
_impl.createViewTree(params.viewTree, params.viewTreeListener, params.label); |
break; |
+ case _viewManagerMethodRegisterViewAssociateName: |
+ var params = _ViewManagerRegisterViewAssociateParams.deserialize( |
+ message.payload); |
+ _impl.registerViewAssociate(params.viewAssociate, params.label); |
+ break; |
+ case _viewManagerMethodRegisterViewAssociateWatcherName: |
+ var params = _ViewManagerRegisterViewAssociateWatcherParams.deserialize( |
+ message.payload); |
+ _impl.registerViewAssociateWatcher(params.viewAssociateWatcher); |
+ break; |
default: |
throw new bindings.MojoCodecError("Unexpected message name"); |
break; |
@@ -415,5 +736,217 @@ class ViewManagerStub extends bindings.Stub { |
} |
} |
+const int _viewAssociateWatcherMethodOnViewAssociateConnectionErrorName = 0; |
+ |
+class _ViewAssociateWatcherServiceDescription implements service_describer.ServiceDescription { |
+ dynamic getTopLevelInterface([Function responseFactory]) => |
+ responseFactory(null); |
+ |
+ dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
+ responseFactory(null); |
+ |
+ dynamic getAllTypeDefinitions([Function responseFactory]) => |
+ responseFactory(null); |
+} |
+ |
+abstract class ViewAssociateWatcher { |
+ static const String serviceName = null; |
+ dynamic onViewAssociateConnectionError(String label,[Function responseFactory = null]); |
+} |
+ |
+ |
+class _ViewAssociateWatcherProxyControl extends bindings.ProxyMessageHandler |
+ implements bindings.ProxyControl { |
+ _ViewAssociateWatcherProxyControl.fromEndpoint( |
+ core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
+ |
+ _ViewAssociateWatcherProxyControl.fromHandle( |
+ core.MojoHandle handle) : super.fromHandle(handle); |
+ |
+ _ViewAssociateWatcherProxyControl.unbound() : super.unbound(); |
+ |
+ service_describer.ServiceDescription get serviceDescription => |
+ new _ViewAssociateWatcherServiceDescription(); |
+ |
+ String get serviceName => ViewAssociateWatcher.serviceName; |
+ |
+ @override |
+ void handleResponse(bindings.ServiceMessage message) { |
+ switch (message.header.type) { |
+ case _viewAssociateWatcherMethodOnViewAssociateConnectionErrorName: |
+ var r = ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams.deserialize( |
+ message.payload); |
+ if (!message.header.hasRequestId) { |
+ proxyError("Expected a message with a valid request Id."); |
+ return; |
+ } |
+ Completer c = completerMap[message.header.requestId]; |
+ if (c == null) { |
+ proxyError( |
+ "Message had unknown request Id: ${message.header.requestId}"); |
+ return; |
+ } |
+ completerMap.remove(message.header.requestId); |
+ if (c.isCompleted) { |
+ proxyError("Response completer already completed"); |
+ return; |
+ } |
+ c.complete(r); |
+ break; |
+ default: |
+ proxyError("Unexpected message type: ${message.header.type}"); |
+ close(immediate: true); |
+ break; |
+ } |
+ } |
+ |
+ @override |
+ String toString() { |
+ var superString = super.toString(); |
+ return "_ViewAssociateWatcherProxyControl($superString)"; |
+ } |
+} |
+ |
+ |
+class ViewAssociateWatcherProxy extends bindings.Proxy |
+ implements ViewAssociateWatcher { |
+ ViewAssociateWatcherProxy.fromEndpoint( |
+ core.MojoMessagePipeEndpoint endpoint) |
+ : super(new _ViewAssociateWatcherProxyControl.fromEndpoint(endpoint)); |
+ |
+ ViewAssociateWatcherProxy.fromHandle(core.MojoHandle handle) |
+ : super(new _ViewAssociateWatcherProxyControl.fromHandle(handle)); |
+ |
+ ViewAssociateWatcherProxy.unbound() |
+ : super(new _ViewAssociateWatcherProxyControl.unbound()); |
+ |
+ static ViewAssociateWatcherProxy newFromEndpoint( |
+ core.MojoMessagePipeEndpoint endpoint) { |
+ assert(endpoint.setDescription("For ViewAssociateWatcherProxy")); |
+ return new ViewAssociateWatcherProxy.fromEndpoint(endpoint); |
+ } |
+ |
+ factory ViewAssociateWatcherProxy.connectToService( |
+ bindings.ServiceConnector s, String url, [String serviceName]) { |
+ ViewAssociateWatcherProxy p = new ViewAssociateWatcherProxy.unbound(); |
+ s.connectToService(url, p, serviceName); |
+ return p; |
+ } |
+ |
+ |
+ dynamic onViewAssociateConnectionError(String label,[Function responseFactory = null]) { |
+ var params = new _ViewAssociateWatcherOnViewAssociateConnectionErrorParams(); |
+ params.label = label; |
+ return ctrl.sendMessageWithRequestId( |
+ params, |
+ _viewAssociateWatcherMethodOnViewAssociateConnectionErrorName, |
+ -1, |
+ bindings.MessageHeader.kMessageExpectsResponse); |
+ } |
+} |
+ |
+ |
+class ViewAssociateWatcherStub extends bindings.Stub { |
+ ViewAssociateWatcher _impl; |
+ |
+ ViewAssociateWatcherStub.fromEndpoint( |
+ core.MojoMessagePipeEndpoint endpoint, [ViewAssociateWatcher impl]) |
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
+ _impl = impl; |
+ } |
+ |
+ ViewAssociateWatcherStub.fromHandle( |
+ core.MojoHandle handle, [ViewAssociateWatcher impl]) |
+ : super.fromHandle(handle, autoBegin: impl != null) { |
+ _impl = impl; |
+ } |
+ |
+ ViewAssociateWatcherStub.unbound([this._impl]) : super.unbound(); |
+ |
+ static ViewAssociateWatcherStub newFromEndpoint( |
+ core.MojoMessagePipeEndpoint endpoint) { |
+ assert(endpoint.setDescription("For ViewAssociateWatcherStub")); |
+ return new ViewAssociateWatcherStub.fromEndpoint(endpoint); |
+ } |
+ |
+ |
+ ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams _viewAssociateWatcherOnViewAssociateConnectionErrorResponseParamsFactory() { |
+ var result = new ViewAssociateWatcherOnViewAssociateConnectionErrorResponseParams(); |
+ return result; |
+ } |
+ |
+ dynamic handleMessage(bindings.ServiceMessage message) { |
+ if (bindings.ControlMessageHandler.isControlMessage(message)) { |
+ return bindings.ControlMessageHandler.handleMessage(this, |
+ 0, |
+ message); |
+ } |
+ if (_impl == null) { |
+ throw new core.MojoApiError("$this has no implementation set"); |
+ } |
+ switch (message.header.type) { |
+ case _viewAssociateWatcherMethodOnViewAssociateConnectionErrorName: |
+ var params = _ViewAssociateWatcherOnViewAssociateConnectionErrorParams.deserialize( |
+ message.payload); |
+ var response = _impl.onViewAssociateConnectionError(params.label,_viewAssociateWatcherOnViewAssociateConnectionErrorResponseParamsFactory); |
+ if (response is Future) { |
+ return response.then((response) { |
+ if (response != null) { |
+ return buildResponseWithId( |
+ response, |
+ _viewAssociateWatcherMethodOnViewAssociateConnectionErrorName, |
+ message.header.requestId, |
+ bindings.MessageHeader.kMessageIsResponse); |
+ } |
+ }); |
+ } else if (response != null) { |
+ return buildResponseWithId( |
+ response, |
+ _viewAssociateWatcherMethodOnViewAssociateConnectionErrorName, |
+ message.header.requestId, |
+ bindings.MessageHeader.kMessageIsResponse); |
+ } |
+ break; |
+ default: |
+ throw new bindings.MojoCodecError("Unexpected message name"); |
+ break; |
+ } |
+ return null; |
+ } |
+ |
+ ViewAssociateWatcher get impl => _impl; |
+ set impl(ViewAssociateWatcher d) { |
+ if (d == null) { |
+ throw new core.MojoApiError("$this: Cannot set a null implementation"); |
+ } |
+ if (isBound && (_impl == null)) { |
+ beginHandlingEvents(); |
+ } |
+ _impl = d; |
+ } |
+ |
+ @override |
+ void bind(core.MojoMessagePipeEndpoint endpoint) { |
+ super.bind(endpoint); |
+ if (!isOpen && (_impl != null)) { |
+ beginHandlingEvents(); |
+ } |
+ } |
+ |
+ String toString() { |
+ var superString = super.toString(); |
+ return "ViewAssociateWatcherStub($superString)"; |
+ } |
+ |
+ int get version => 0; |
+ |
+ static service_describer.ServiceDescription _cachedServiceDescription; |
+ static service_describer.ServiceDescription get serviceDescription { |
+ if (_cachedServiceDescription == null) { |
+ _cachedServiceDescription = new _ViewAssociateWatcherServiceDescription(); |
+ } |
+ return _cachedServiceDescription; |
+ } |
+} |