Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Unified Diff: mojo/dart/packages/mojo_services/lib/contacts/contacts.mojom.dart

Issue 1449203002: Check in generated Dart bindings and add presubmit script (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/dart/packages/mojo_services/lib/contacts/contacts.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/contacts/contacts.mojom.dart b/mojo/dart/packages/mojo_services/lib/contacts/contacts.mojom.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d8f44eeb32a26b6ec5ead2460829d25ab2e8825f
--- /dev/null
+++ b/mojo/dart/packages/mojo_services/lib/contacts/contacts.mojom.dart
@@ -0,0 +1,1078 @@
+// 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.
+
+library contacts_mojom;
+
+import 'dart:async';
+
+import 'package:mojo/bindings.dart' as bindings;
+import 'package:mojo/core.dart' as core;
+
+
+
+class Contact extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(24, 0)
+ ];
+ int id = 0;
+ String name = null;
+
+ Contact() : super(kVersions.last.size);
+
+ static Contact 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 Contact decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ Contact result = new Contact();
+
+ 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.id = decoder0.decodeInt64(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.name = decoder0.decodeString(16, false);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInt64(id, 8);
+
+ encoder0.encodeString(name, 16, false);
+ }
+
+ String toString() {
+ return "Contact("
+ "id: $id" ", "
+ "name: $name" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["id"] = id;
+ map["name"] = name;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetCountParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ String filter = null;
+
+ ContactsServiceGetCountParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetCountParams 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 ContactsServiceGetCountParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetCountParams result = new ContactsServiceGetCountParams();
+
+ 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.filter = decoder0.decodeString(8, true);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeString(filter, 8, true);
+ }
+
+ String toString() {
+ return "ContactsServiceGetCountParams("
+ "filter: $filter" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["filter"] = filter;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetCountResponseParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ int count = 0;
+
+ ContactsServiceGetCountResponseParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetCountResponseParams 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 ContactsServiceGetCountResponseParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetCountResponseParams result = new ContactsServiceGetCountResponseParams();
+
+ 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.count = decoder0.decodeUint64(8);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeUint64(count, 8);
+ }
+
+ String toString() {
+ return "ContactsServiceGetCountResponseParams("
+ "count: $count" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["count"] = count;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(24, 0)
+ ];
+ String filter = null;
+ int offset = 0;
+ int limit = 0;
+
+ ContactsServiceGetParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetParams 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 ContactsServiceGetParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetParams result = new ContactsServiceGetParams();
+
+ 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.filter = decoder0.decodeString(8, true);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.offset = decoder0.decodeUint32(16);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.limit = decoder0.decodeUint32(20);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeString(filter, 8, true);
+
+ encoder0.encodeUint32(offset, 16);
+
+ encoder0.encodeUint32(limit, 20);
+ }
+
+ String toString() {
+ return "ContactsServiceGetParams("
+ "filter: $filter" ", "
+ "offset: $offset" ", "
+ "limit: $limit" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["filter"] = filter;
+ map["offset"] = offset;
+ map["limit"] = limit;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetResponseParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ List<Contact> contacts = null;
+
+ ContactsServiceGetResponseParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetResponseParams 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 ContactsServiceGetResponseParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetResponseParams result = new ContactsServiceGetResponseParams();
+
+ 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) {
+
+ var decoder1 = decoder0.decodePointer(8, false);
+ {
+ var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecifiedArrayLength);
+ result.contacts = new List<Contact>(si1.numElements);
+ for (int i1 = 0; i1 < si1.numElements; ++i1) {
+
+ var decoder2 = decoder1.decodePointer(bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i1, false);
+ result.contacts[i1] = Contact.decode(decoder2);
+ }
+ }
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ if (contacts == null) {
+ encoder0.encodeNullPointer(8, false);
+ } else {
+ var encoder1 = encoder0.encodePointerArray(contacts.length, 8, bindings.kUnspecifiedArrayLength);
+ for (int i0 = 0; i0 < contacts.length; ++i0) {
+
+ encoder1.encodeStruct(contacts[i0], bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i0, false);
+ }
+ }
+ }
+
+ String toString() {
+ return "ContactsServiceGetResponseParams("
+ "contacts: $contacts" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["contacts"] = contacts;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetEmailsParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ int id = 0;
+
+ ContactsServiceGetEmailsParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetEmailsParams 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 ContactsServiceGetEmailsParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetEmailsParams result = new ContactsServiceGetEmailsParams();
+
+ 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.id = decoder0.decodeInt64(8);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInt64(id, 8);
+ }
+
+ String toString() {
+ return "ContactsServiceGetEmailsParams("
+ "id: $id" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["id"] = id;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetEmailsResponseParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ List<String> emails = null;
+
+ ContactsServiceGetEmailsResponseParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetEmailsResponseParams 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 ContactsServiceGetEmailsResponseParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetEmailsResponseParams result = new ContactsServiceGetEmailsResponseParams();
+
+ 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) {
+
+ var decoder1 = decoder0.decodePointer(8, false);
+ {
+ var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecifiedArrayLength);
+ result.emails = new List<String>(si1.numElements);
+ for (int i1 = 0; i1 < si1.numElements; ++i1) {
+
+ result.emails[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i1, false);
+ }
+ }
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ if (emails == null) {
+ encoder0.encodeNullPointer(8, false);
+ } else {
+ var encoder1 = encoder0.encodePointerArray(emails.length, 8, bindings.kUnspecifiedArrayLength);
+ for (int i0 = 0; i0 < emails.length; ++i0) {
+
+ encoder1.encodeString(emails[i0], bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i0, false);
+ }
+ }
+ }
+
+ String toString() {
+ return "ContactsServiceGetEmailsResponseParams("
+ "emails: $emails" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["emails"] = emails;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetPhotoParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(24, 0)
+ ];
+ int id = 0;
+ bool highResolution = false;
+
+ ContactsServiceGetPhotoParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetPhotoParams 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 ContactsServiceGetPhotoParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetPhotoParams result = new ContactsServiceGetPhotoParams();
+
+ 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.id = decoder0.decodeInt64(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.highResolution = decoder0.decodeBool(16, 0);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInt64(id, 8);
+
+ encoder0.encodeBool(highResolution, 16, 0);
+ }
+
+ String toString() {
+ return "ContactsServiceGetPhotoParams("
+ "id: $id" ", "
+ "highResolution: $highResolution" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["id"] = id;
+ map["highResolution"] = highResolution;
+ return map;
+ }
+}
+
+
+class ContactsServiceGetPhotoResponseParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ String photoUrl = null;
+
+ ContactsServiceGetPhotoResponseParams() : super(kVersions.last.size);
+
+ static ContactsServiceGetPhotoResponseParams 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 ContactsServiceGetPhotoResponseParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ContactsServiceGetPhotoResponseParams result = new ContactsServiceGetPhotoResponseParams();
+
+ 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.photoUrl = decoder0.decodeString(8, true);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeString(photoUrl, 8, true);
+ }
+
+ String toString() {
+ return "ContactsServiceGetPhotoResponseParams("
+ "photoUrl: $photoUrl" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["photoUrl"] = photoUrl;
+ return map;
+ }
+}
+
+const int kContactsService_getCount_name = 0;
+const int kContactsService_get_name = 1;
+const int kContactsService_getEmails_name = 2;
+const int kContactsService_getPhoto_name = 3;
+
+const String ContactsServiceName =
+ 'contacts::ContactsService';
+
+abstract class ContactsService {
+ dynamic getCount(String filter,[Function responseFactory = null]);
+ dynamic get(String filter,int offset,int limit,[Function responseFactory = null]);
+ dynamic getEmails(int id,[Function responseFactory = null]);
+ dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null]);
+
+}
+
+
+class ContactsServiceProxyImpl extends bindings.Proxy {
+ ContactsServiceProxyImpl.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
+
+ ContactsServiceProxyImpl.fromHandle(core.MojoHandle handle) :
+ super.fromHandle(handle);
+
+ ContactsServiceProxyImpl.unbound() : super.unbound();
+
+ static ContactsServiceProxyImpl newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For ContactsServiceProxyImpl"));
+ return new ContactsServiceProxyImpl.fromEndpoint(endpoint);
+ }
+
+ String get name => ContactsServiceName;
+
+ void handleResponse(bindings.ServiceMessage message) {
+ switch (message.header.type) {
+ case kContactsService_getCount_name:
+ var r = ContactsServiceGetCountResponseParams.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;
+ case kContactsService_get_name:
+ var r = ContactsServiceGetResponseParams.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;
+ case kContactsService_getEmails_name:
+ var r = ContactsServiceGetEmailsResponseParams.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;
+ case kContactsService_getPhoto_name:
+ var r = ContactsServiceGetPhotoResponseParams.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;
+ }
+ }
+
+ String toString() {
+ var superString = super.toString();
+ return "ContactsServiceProxyImpl($superString)";
+ }
+}
+
+
+class _ContactsServiceProxyCalls implements ContactsService {
+ ContactsServiceProxyImpl _proxyImpl;
+
+ _ContactsServiceProxyCalls(this._proxyImpl);
+ dynamic getCount(String filter,[Function responseFactory = null]) {
+ var params = new ContactsServiceGetCountParams();
+ params.filter = filter;
+ return _proxyImpl.sendMessageWithRequestId(
+ params,
+ kContactsService_getCount_name,
+ -1,
+ bindings.MessageHeader.kMessageExpectsResponse);
+ }
+ dynamic get(String filter,int offset,int limit,[Function responseFactory = null]) {
+ var params = new ContactsServiceGetParams();
+ params.filter = filter;
+ params.offset = offset;
+ params.limit = limit;
+ return _proxyImpl.sendMessageWithRequestId(
+ params,
+ kContactsService_get_name,
+ -1,
+ bindings.MessageHeader.kMessageExpectsResponse);
+ }
+ dynamic getEmails(int id,[Function responseFactory = null]) {
+ var params = new ContactsServiceGetEmailsParams();
+ params.id = id;
+ return _proxyImpl.sendMessageWithRequestId(
+ params,
+ kContactsService_getEmails_name,
+ -1,
+ bindings.MessageHeader.kMessageExpectsResponse);
+ }
+ dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null]) {
+ var params = new ContactsServiceGetPhotoParams();
+ params.id = id;
+ params.highResolution = highResolution;
+ return _proxyImpl.sendMessageWithRequestId(
+ params,
+ kContactsService_getPhoto_name,
+ -1,
+ bindings.MessageHeader.kMessageExpectsResponse);
+ }
+}
+
+
+class ContactsServiceProxy implements bindings.ProxyBase {
+ final bindings.Proxy impl;
+ ContactsService ptr;
+ final String name = ContactsServiceName;
+
+ ContactsServiceProxy(ContactsServiceProxyImpl proxyImpl) :
+ impl = proxyImpl,
+ ptr = new _ContactsServiceProxyCalls(proxyImpl);
+
+ ContactsServiceProxy.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) :
+ impl = new ContactsServiceProxyImpl.fromEndpoint(endpoint) {
+ ptr = new _ContactsServiceProxyCalls(impl);
+ }
+
+ ContactsServiceProxy.fromHandle(core.MojoHandle handle) :
+ impl = new ContactsServiceProxyImpl.fromHandle(handle) {
+ ptr = new _ContactsServiceProxyCalls(impl);
+ }
+
+ ContactsServiceProxy.unbound() :
+ impl = new ContactsServiceProxyImpl.unbound() {
+ ptr = new _ContactsServiceProxyCalls(impl);
+ }
+
+ factory ContactsServiceProxy.connectToService(
+ bindings.ServiceConnector s, String url) {
+ ContactsServiceProxy p = new ContactsServiceProxy.unbound();
+ s.connectToService(url, p);
+ return p;
+ }
+
+ static ContactsServiceProxy newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For ContactsServiceProxy"));
+ return new ContactsServiceProxy.fromEndpoint(endpoint);
+ }
+
+ Future close({bool immediate: false}) => impl.close(immediate: immediate);
+
+ Future responseOrError(Future f) => impl.responseOrError(f);
+
+ Future get errorFuture => impl.errorFuture;
+
+ int get version => impl.version;
+
+ Future<int> queryVersion() => impl.queryVersion();
+
+ void requireVersion(int requiredVersion) {
+ impl.requireVersion(requiredVersion);
+ }
+
+ String toString() {
+ return "ContactsServiceProxy($impl)";
+ }
+}
+
+
+class ContactsServiceStub extends bindings.Stub {
+ ContactsService _impl = null;
+
+ ContactsServiceStub.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint, [this._impl])
+ : super.fromEndpoint(endpoint);
+
+ ContactsServiceStub.fromHandle(core.MojoHandle handle, [this._impl])
+ : super.fromHandle(handle);
+
+ ContactsServiceStub.unbound() : super.unbound();
+
+ static ContactsServiceStub newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For ContactsServiceStub"));
+ return new ContactsServiceStub.fromEndpoint(endpoint);
+ }
+
+ static const String name = ContactsServiceName;
+
+
+ ContactsServiceGetCountResponseParams _ContactsServiceGetCountResponseParamsFactory(int count) {
+ var result = new ContactsServiceGetCountResponseParams();
+ result.count = count;
+ return result;
+ }
+ ContactsServiceGetResponseParams _ContactsServiceGetResponseParamsFactory(List<Contact> contacts) {
+ var result = new ContactsServiceGetResponseParams();
+ result.contacts = contacts;
+ return result;
+ }
+ ContactsServiceGetEmailsResponseParams _ContactsServiceGetEmailsResponseParamsFactory(List<String> emails) {
+ var result = new ContactsServiceGetEmailsResponseParams();
+ result.emails = emails;
+ return result;
+ }
+ ContactsServiceGetPhotoResponseParams _ContactsServiceGetPhotoResponseParamsFactory(String photoUrl) {
+ var result = new ContactsServiceGetPhotoResponseParams();
+ result.photoUrl = photoUrl;
+ return result;
+ }
+
+ dynamic handleMessage(bindings.ServiceMessage message) {
+ if (bindings.ControlMessageHandler.isControlMessage(message)) {
+ return bindings.ControlMessageHandler.handleMessage(this,
+ 0,
+ message);
+ }
+ assert(_impl != null);
+ switch (message.header.type) {
+ case kContactsService_getCount_name:
+ var params = ContactsServiceGetCountParams.deserialize(
+ message.payload);
+ var response = _impl.getCount(params.filter,_ContactsServiceGetCountResponseParamsFactory);
+ if (response is Future) {
+ return response.then((response) {
+ if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_getCount_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ });
+ } else if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_getCount_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ break;
+ case kContactsService_get_name:
+ var params = ContactsServiceGetParams.deserialize(
+ message.payload);
+ var response = _impl.get(params.filter,params.offset,params.limit,_ContactsServiceGetResponseParamsFactory);
+ if (response is Future) {
+ return response.then((response) {
+ if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_get_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ });
+ } else if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_get_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ break;
+ case kContactsService_getEmails_name:
+ var params = ContactsServiceGetEmailsParams.deserialize(
+ message.payload);
+ var response = _impl.getEmails(params.id,_ContactsServiceGetEmailsResponseParamsFactory);
+ if (response is Future) {
+ return response.then((response) {
+ if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_getEmails_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ });
+ } else if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_getEmails_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ break;
+ case kContactsService_getPhoto_name:
+ var params = ContactsServiceGetPhotoParams.deserialize(
+ message.payload);
+ var response = _impl.getPhoto(params.id,params.highResolution,_ContactsServiceGetPhotoResponseParamsFactory);
+ if (response is Future) {
+ return response.then((response) {
+ if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_getPhoto_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ });
+ } else if (response != null) {
+ return buildResponseWithId(
+ response,
+ kContactsService_getPhoto_name,
+ message.header.requestId,
+ bindings.MessageHeader.kMessageIsResponse);
+ }
+ break;
+ default:
+ throw new bindings.MojoCodecError("Unexpected message name");
+ break;
+ }
+ return null;
+ }
+
+ ContactsService get impl => _impl;
+ set impl(ContactsService d) {
+ assert(_impl == null);
+ _impl = d;
+ }
+
+ String toString() {
+ var superString = super.toString();
+ return "ContactsServiceStub($superString)";
+ }
+
+ int get version => 0;
+}
+
+

Powered by Google App Engine
This is Rietveld 408576698