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

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

Issue 1998433002: Dart: Adds Interface and InterfaceRequest interfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 months 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
index a8066069c71a9f939b381e7bcbe65a826002c2d2..9b9a5c88291de2115f6965fb7ce6574cc84d1744 100644
--- a/mojo/dart/packages/mojo_services/lib/contacts/contacts.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/contacts/contacts.mojom.dart
@@ -762,15 +762,53 @@ class _ContactsServiceServiceDescription implements service_describer.ServiceDes
abstract class ContactsService {
static const String serviceName = "contacts::ContactsService";
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _ContactsServiceServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static ContactsServiceProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ ContactsServiceProxy p = new ContactsServiceProxy.unbound();
+ String name = serviceName ?? ContactsService.serviceName;
+ if ((name == null) || name.isEmpty) {
+ throw new core.MojoApiError(
+ "If an interface has no ServiceName, then one must be provided.");
+ }
+ s.connectToService(url, p, name);
+ return p;
+ }
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]);
}
+abstract class ContactsServiceInterface
+ implements bindings.MojoInterface<ContactsService>,
+ ContactsService {
+ factory ContactsServiceInterface([ContactsService impl]) =>
+ new ContactsServiceStub.unbound(impl);
+ factory ContactsServiceInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [ContactsService impl]) =>
+ new ContactsServiceStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class ContactsServiceInterfaceRequest
+ implements bindings.MojoInterface<ContactsService>,
+ ContactsService {
+ factory ContactsServiceInterfaceRequest() =>
+ new ContactsServiceProxy.unbound();
+}
+
class _ContactsServiceProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<ContactsService> {
_ContactsServiceProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -779,9 +817,6 @@ class _ContactsServiceProxyControl
_ContactsServiceProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _ContactsServiceServiceDescription();
-
String get serviceName => ContactsService.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -873,6 +908,11 @@ class _ContactsServiceProxyControl
}
}
+ ContactsService get impl => null;
+ set impl(ContactsService _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -881,8 +921,10 @@ class _ContactsServiceProxyControl
}
class ContactsServiceProxy
- extends bindings.Proxy
- implements ContactsService {
+ extends bindings.Proxy<ContactsService>
+ implements ContactsService,
+ ContactsServiceInterface,
+ ContactsServiceInterfaceRequest {
ContactsServiceProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _ContactsServiceProxyControl.fromEndpoint(endpoint));
@@ -899,13 +941,6 @@ class ContactsServiceProxy
return new ContactsServiceProxy.fromEndpoint(endpoint);
}
- factory ContactsServiceProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- ContactsServiceProxy p = new ContactsServiceProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
dynamic getCount(String filter,[Function responseFactory = null]) {
var params = new _ContactsServiceGetCountParams();
@@ -967,6 +1002,8 @@ class _ContactsServiceStubControl
_ContactsServiceStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => ContactsService.serviceName;
+
ContactsServiceGetCountResponseParams _contactsServiceGetCountResponseParamsFactory(int count) {
var result = new ContactsServiceGetCountResponseParams();
@@ -1120,19 +1157,16 @@ class _ContactsServiceStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _ContactsServiceServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class ContactsServiceStub
extends bindings.Stub<ContactsService>
- implements ContactsService {
+ implements ContactsService,
+ ContactsServiceInterface,
+ ContactsServiceInterfaceRequest {
+ ContactsServiceStub.unbound([ContactsService impl])
+ : super(new _ContactsServiceStubControl.unbound(impl));
+
ContactsServiceStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [ContactsService impl])
: super(new _ContactsServiceStubControl.fromEndpoint(endpoint, impl));
@@ -1141,18 +1175,12 @@ class ContactsServiceStub
core.MojoHandle handle, [ContactsService impl])
: super(new _ContactsServiceStubControl.fromHandle(handle, impl));
- ContactsServiceStub.unbound([ContactsService impl])
- : super(new _ContactsServiceStubControl.unbound(impl));
-
static ContactsServiceStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For ContactsServiceStub"));
return new ContactsServiceStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _ContactsServiceStubControl.serviceDescription;
-
dynamic getCount(String filter,[Function responseFactory = null]) {
return impl.getCount(filter,responseFactory);

Powered by Google App Engine
This is Rietveld 408576698