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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.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/mojo/ui/view_token.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart
index c327087da6457dea5769d20b1533c60d317995b6..90882e2ce0d84598539f8fc0bf9f0783f4ab5ae1 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_token.mojom.dart
@@ -227,12 +227,50 @@ class _ViewOwnerServiceDescription implements service_describer.ServiceDescripti
abstract class ViewOwner {
static const String serviceName = null;
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _ViewOwnerServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static ViewOwnerProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ ViewOwnerProxy p = new ViewOwnerProxy.unbound();
+ String name = serviceName ?? ViewOwner.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 getToken([Function responseFactory = null]);
}
+abstract class ViewOwnerInterface
+ implements bindings.MojoInterface<ViewOwner>,
+ ViewOwner {
+ factory ViewOwnerInterface([ViewOwner impl]) =>
+ new ViewOwnerStub.unbound(impl);
+ factory ViewOwnerInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [ViewOwner impl]) =>
+ new ViewOwnerStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class ViewOwnerInterfaceRequest
+ implements bindings.MojoInterface<ViewOwner>,
+ ViewOwner {
+ factory ViewOwnerInterfaceRequest() =>
+ new ViewOwnerProxy.unbound();
+}
+
class _ViewOwnerProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<ViewOwner> {
_ViewOwnerProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -241,9 +279,6 @@ class _ViewOwnerProxyControl
_ViewOwnerProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _ViewOwnerServiceDescription();
-
String get serviceName => ViewOwner.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -275,6 +310,11 @@ class _ViewOwnerProxyControl
}
}
+ ViewOwner get impl => null;
+ set impl(ViewOwner _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -283,8 +323,10 @@ class _ViewOwnerProxyControl
}
class ViewOwnerProxy
- extends bindings.Proxy
- implements ViewOwner {
+ extends bindings.Proxy<ViewOwner>
+ implements ViewOwner,
+ ViewOwnerInterface,
+ ViewOwnerInterfaceRequest {
ViewOwnerProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _ViewOwnerProxyControl.fromEndpoint(endpoint));
@@ -301,13 +343,6 @@ class ViewOwnerProxy
return new ViewOwnerProxy.fromEndpoint(endpoint);
}
- factory ViewOwnerProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- ViewOwnerProxy p = new ViewOwnerProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
dynamic getToken([Function responseFactory = null]) {
var params = new _ViewOwnerGetTokenParams();
@@ -338,6 +373,8 @@ class _ViewOwnerStubControl
_ViewOwnerStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => ViewOwner.serviceName;
+
ViewOwnerGetTokenResponseParams _viewOwnerGetTokenResponseParamsFactory(ViewToken token) {
var result = new ViewOwnerGetTokenResponseParams();
@@ -408,19 +445,16 @@ class _ViewOwnerStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _ViewOwnerServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class ViewOwnerStub
extends bindings.Stub<ViewOwner>
- implements ViewOwner {
+ implements ViewOwner,
+ ViewOwnerInterface,
+ ViewOwnerInterfaceRequest {
+ ViewOwnerStub.unbound([ViewOwner impl])
+ : super(new _ViewOwnerStubControl.unbound(impl));
+
ViewOwnerStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [ViewOwner impl])
: super(new _ViewOwnerStubControl.fromEndpoint(endpoint, impl));
@@ -429,18 +463,12 @@ class ViewOwnerStub
core.MojoHandle handle, [ViewOwner impl])
: super(new _ViewOwnerStubControl.fromHandle(handle, impl));
- ViewOwnerStub.unbound([ViewOwner impl])
- : super(new _ViewOwnerStubControl.unbound(impl));
-
static ViewOwnerStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For ViewOwnerStub"));
return new ViewOwnerStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _ViewOwnerStubControl.serviceDescription;
-
dynamic getToken([Function responseFactory = null]) {
return impl.getToken(responseFactory);

Powered by Google App Engine
This is Rietveld 408576698