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

Unified Diff: mojo/dart/packages/mojo_services/lib/notifications/notifications.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/notifications/notifications.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/notifications/notifications.mojom.dart b/mojo/dart/packages/mojo_services/lib/notifications/notifications.mojom.dart
index f356c900a6c062ab7012186ad814b58044694da3..7cd6ce7ac0657a88c9e8901fcdb9c6189efd4d20 100644
--- a/mojo/dart/packages/mojo_services/lib/notifications/notifications.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/notifications/notifications.mojom.dart
@@ -390,8 +390,8 @@ class _NotificationServicePostParams extends bindings.Struct {
const bindings.StructDataHeader(32, 0)
];
NotificationData notificationData = null;
- Object client = null;
- Object notification = null;
+ NotificationClientInterface client = null;
+ NotificationInterfaceRequest notification = null;
_NotificationServicePostParams() : super(kVersions.last.size);
@@ -498,13 +498,51 @@ class _NotificationClientServiceDescription implements service_describer.Service
abstract class NotificationClient {
static const String serviceName = null;
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _NotificationClientServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static NotificationClientProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ NotificationClientProxy p = new NotificationClientProxy.unbound();
+ String name = serviceName ?? NotificationClient.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;
+ }
void onSelected();
void onDismissed();
}
+abstract class NotificationClientInterface
+ implements bindings.MojoInterface<NotificationClient>,
+ NotificationClient {
+ factory NotificationClientInterface([NotificationClient impl]) =>
+ new NotificationClientStub.unbound(impl);
+ factory NotificationClientInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [NotificationClient impl]) =>
+ new NotificationClientStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class NotificationClientInterfaceRequest
+ implements bindings.MojoInterface<NotificationClient>,
+ NotificationClient {
+ factory NotificationClientInterfaceRequest() =>
+ new NotificationClientProxy.unbound();
+}
+
class _NotificationClientProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<NotificationClient> {
_NotificationClientProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -513,9 +551,6 @@ class _NotificationClientProxyControl
_NotificationClientProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _NotificationClientServiceDescription();
-
String get serviceName => NotificationClient.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -527,6 +562,11 @@ class _NotificationClientProxyControl
}
}
+ NotificationClient get impl => null;
+ set impl(NotificationClient _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -535,8 +575,10 @@ class _NotificationClientProxyControl
}
class NotificationClientProxy
- extends bindings.Proxy
- implements NotificationClient {
+ extends bindings.Proxy<NotificationClient>
+ implements NotificationClient,
+ NotificationClientInterface,
+ NotificationClientInterfaceRequest {
NotificationClientProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _NotificationClientProxyControl.fromEndpoint(endpoint));
@@ -553,13 +595,6 @@ class NotificationClientProxy
return new NotificationClientProxy.fromEndpoint(endpoint);
}
- factory NotificationClientProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- NotificationClientProxy p = new NotificationClientProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
void onSelected() {
if (!ctrl.isBound) {
@@ -600,6 +635,8 @@ class _NotificationClientStubControl
_NotificationClientStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => NotificationClient.serviceName;
+
dynamic handleMessage(bindings.ServiceMessage message) {
@@ -651,19 +688,16 @@ class _NotificationClientStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _NotificationClientServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class NotificationClientStub
extends bindings.Stub<NotificationClient>
- implements NotificationClient {
+ implements NotificationClient,
+ NotificationClientInterface,
+ NotificationClientInterfaceRequest {
+ NotificationClientStub.unbound([NotificationClient impl])
+ : super(new _NotificationClientStubControl.unbound(impl));
+
NotificationClientStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [NotificationClient impl])
: super(new _NotificationClientStubControl.fromEndpoint(endpoint, impl));
@@ -672,18 +706,12 @@ class NotificationClientStub
core.MojoHandle handle, [NotificationClient impl])
: super(new _NotificationClientStubControl.fromHandle(handle, impl));
- NotificationClientStub.unbound([NotificationClient impl])
- : super(new _NotificationClientStubControl.unbound(impl));
-
static NotificationClientStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For NotificationClientStub"));
return new NotificationClientStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _NotificationClientStubControl.serviceDescription;
-
void onSelected() {
return impl.onSelected();
@@ -709,13 +737,51 @@ class _NotificationServiceDescription implements service_describer.ServiceDescri
abstract class Notification {
static const String serviceName = null;
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _NotificationServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static NotificationProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ NotificationProxy p = new NotificationProxy.unbound();
+ String name = serviceName ?? Notification.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;
+ }
void update(NotificationData notificationData);
void cancel();
}
+abstract class NotificationInterface
+ implements bindings.MojoInterface<Notification>,
+ Notification {
+ factory NotificationInterface([Notification impl]) =>
+ new NotificationStub.unbound(impl);
+ factory NotificationInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [Notification impl]) =>
+ new NotificationStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class NotificationInterfaceRequest
+ implements bindings.MojoInterface<Notification>,
+ Notification {
+ factory NotificationInterfaceRequest() =>
+ new NotificationProxy.unbound();
+}
+
class _NotificationProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<Notification> {
_NotificationProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -724,9 +790,6 @@ class _NotificationProxyControl
_NotificationProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _NotificationServiceDescription();
-
String get serviceName => Notification.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -738,6 +801,11 @@ class _NotificationProxyControl
}
}
+ Notification get impl => null;
+ set impl(Notification _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -746,8 +814,10 @@ class _NotificationProxyControl
}
class NotificationProxy
- extends bindings.Proxy
- implements Notification {
+ extends bindings.Proxy<Notification>
+ implements Notification,
+ NotificationInterface,
+ NotificationInterfaceRequest {
NotificationProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _NotificationProxyControl.fromEndpoint(endpoint));
@@ -764,13 +834,6 @@ class NotificationProxy
return new NotificationProxy.fromEndpoint(endpoint);
}
- factory NotificationProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- NotificationProxy p = new NotificationProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
void update(NotificationData notificationData) {
if (!ctrl.isBound) {
@@ -812,6 +875,8 @@ class _NotificationStubControl
_NotificationStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => Notification.serviceName;
+
dynamic handleMessage(bindings.ServiceMessage message) {
@@ -865,19 +930,16 @@ class _NotificationStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _NotificationServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class NotificationStub
extends bindings.Stub<Notification>
- implements Notification {
+ implements Notification,
+ NotificationInterface,
+ NotificationInterfaceRequest {
+ NotificationStub.unbound([Notification impl])
+ : super(new _NotificationStubControl.unbound(impl));
+
NotificationStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [Notification impl])
: super(new _NotificationStubControl.fromEndpoint(endpoint, impl));
@@ -886,18 +948,12 @@ class NotificationStub
core.MojoHandle handle, [Notification impl])
: super(new _NotificationStubControl.fromHandle(handle, impl));
- NotificationStub.unbound([Notification impl])
- : super(new _NotificationStubControl.unbound(impl));
-
static NotificationStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For NotificationStub"));
return new NotificationStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _NotificationStubControl.serviceDescription;
-
void update(NotificationData notificationData) {
return impl.update(notificationData);
@@ -922,12 +978,50 @@ class _NotificationServiceServiceDescription implements service_describer.Servic
abstract class NotificationService {
static const String serviceName = "notifications::NotificationService";
- void post(NotificationData notificationData, Object client, Object notification);
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _NotificationServiceServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static NotificationServiceProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ NotificationServiceProxy p = new NotificationServiceProxy.unbound();
+ String name = serviceName ?? NotificationService.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;
+ }
+ void post(NotificationData notificationData, NotificationClientInterface client, NotificationInterfaceRequest notification);
+}
+
+abstract class NotificationServiceInterface
+ implements bindings.MojoInterface<NotificationService>,
+ NotificationService {
+ factory NotificationServiceInterface([NotificationService impl]) =>
+ new NotificationServiceStub.unbound(impl);
+ factory NotificationServiceInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [NotificationService impl]) =>
+ new NotificationServiceStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class NotificationServiceInterfaceRequest
+ implements bindings.MojoInterface<NotificationService>,
+ NotificationService {
+ factory NotificationServiceInterfaceRequest() =>
+ new NotificationServiceProxy.unbound();
}
class _NotificationServiceProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<NotificationService> {
_NotificationServiceProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -936,9 +1030,6 @@ class _NotificationServiceProxyControl
_NotificationServiceProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _NotificationServiceServiceDescription();
-
String get serviceName => NotificationService.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -950,6 +1041,11 @@ class _NotificationServiceProxyControl
}
}
+ NotificationService get impl => null;
+ set impl(NotificationService _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -958,8 +1054,10 @@ class _NotificationServiceProxyControl
}
class NotificationServiceProxy
- extends bindings.Proxy
- implements NotificationService {
+ extends bindings.Proxy<NotificationService>
+ implements NotificationService,
+ NotificationServiceInterface,
+ NotificationServiceInterfaceRequest {
NotificationServiceProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _NotificationServiceProxyControl.fromEndpoint(endpoint));
@@ -976,15 +1074,8 @@ class NotificationServiceProxy
return new NotificationServiceProxy.fromEndpoint(endpoint);
}
- factory NotificationServiceProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- NotificationServiceProxy p = new NotificationServiceProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
- void post(NotificationData notificationData, Object client, Object notification) {
+ void post(NotificationData notificationData, NotificationClientInterface client, NotificationInterfaceRequest notification) {
if (!ctrl.isBound) {
ctrl.proxyError("The Proxy is closed.");
return;
@@ -1017,6 +1108,8 @@ class _NotificationServiceStubControl
_NotificationServiceStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => NotificationService.serviceName;
+
dynamic handleMessage(bindings.ServiceMessage message) {
@@ -1067,19 +1160,16 @@ class _NotificationServiceStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _NotificationServiceServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class NotificationServiceStub
extends bindings.Stub<NotificationService>
- implements NotificationService {
+ implements NotificationService,
+ NotificationServiceInterface,
+ NotificationServiceInterfaceRequest {
+ NotificationServiceStub.unbound([NotificationService impl])
+ : super(new _NotificationServiceStubControl.unbound(impl));
+
NotificationServiceStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [NotificationService impl])
: super(new _NotificationServiceStubControl.fromEndpoint(endpoint, impl));
@@ -1088,20 +1178,14 @@ class NotificationServiceStub
core.MojoHandle handle, [NotificationService impl])
: super(new _NotificationServiceStubControl.fromHandle(handle, impl));
- NotificationServiceStub.unbound([NotificationService impl])
- : super(new _NotificationServiceStubControl.unbound(impl));
-
static NotificationServiceStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For NotificationServiceStub"));
return new NotificationServiceStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _NotificationServiceStubControl.serviceDescription;
-
- void post(NotificationData notificationData, Object client, Object notification) {
+ void post(NotificationData notificationData, NotificationClientInterface client, NotificationInterfaceRequest notification) {
return impl.post(notificationData, client, notification);
}
}

Powered by Google App Engine
This is Rietveld 408576698