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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.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/input_dispatcher.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart
index 4be8b0436608530c4224e072631cb3055ce74f0a..8c33385d43a617851cb0f4720039f7e3a4662f8c 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart
@@ -98,12 +98,50 @@ class _InputDispatcherServiceDescription implements service_describer.ServiceDes
abstract class InputDispatcher {
static const String serviceName = "mojo::ui::InputDispatcher";
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _InputDispatcherServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static InputDispatcherProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ InputDispatcherProxy p = new InputDispatcherProxy.unbound();
+ String name = serviceName ?? InputDispatcher.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 dispatchEvent(input_events_mojom.Event event);
}
+abstract class InputDispatcherInterface
+ implements bindings.MojoInterface<InputDispatcher>,
+ InputDispatcher {
+ factory InputDispatcherInterface([InputDispatcher impl]) =>
+ new InputDispatcherStub.unbound(impl);
+ factory InputDispatcherInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [InputDispatcher impl]) =>
+ new InputDispatcherStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class InputDispatcherInterfaceRequest
+ implements bindings.MojoInterface<InputDispatcher>,
+ InputDispatcher {
+ factory InputDispatcherInterfaceRequest() =>
+ new InputDispatcherProxy.unbound();
+}
+
class _InputDispatcherProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<InputDispatcher> {
_InputDispatcherProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -112,9 +150,6 @@ class _InputDispatcherProxyControl
_InputDispatcherProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _InputDispatcherServiceDescription();
-
String get serviceName => InputDispatcher.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -126,6 +161,11 @@ class _InputDispatcherProxyControl
}
}
+ InputDispatcher get impl => null;
+ set impl(InputDispatcher _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -134,8 +174,10 @@ class _InputDispatcherProxyControl
}
class InputDispatcherProxy
- extends bindings.Proxy
- implements InputDispatcher {
+ extends bindings.Proxy<InputDispatcher>
+ implements InputDispatcher,
+ InputDispatcherInterface,
+ InputDispatcherInterfaceRequest {
InputDispatcherProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _InputDispatcherProxyControl.fromEndpoint(endpoint));
@@ -152,13 +194,6 @@ class InputDispatcherProxy
return new InputDispatcherProxy.fromEndpoint(endpoint);
}
- factory InputDispatcherProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- InputDispatcherProxy p = new InputDispatcherProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
void dispatchEvent(input_events_mojom.Event event) {
if (!ctrl.isBound) {
@@ -191,6 +226,8 @@ class _InputDispatcherStubControl
_InputDispatcherStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => InputDispatcher.serviceName;
+
dynamic handleMessage(bindings.ServiceMessage message) {
@@ -241,19 +278,16 @@ class _InputDispatcherStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _InputDispatcherServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class InputDispatcherStub
extends bindings.Stub<InputDispatcher>
- implements InputDispatcher {
+ implements InputDispatcher,
+ InputDispatcherInterface,
+ InputDispatcherInterfaceRequest {
+ InputDispatcherStub.unbound([InputDispatcher impl])
+ : super(new _InputDispatcherStubControl.unbound(impl));
+
InputDispatcherStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [InputDispatcher impl])
: super(new _InputDispatcherStubControl.fromEndpoint(endpoint, impl));
@@ -262,18 +296,12 @@ class InputDispatcherStub
core.MojoHandle handle, [InputDispatcher impl])
: super(new _InputDispatcherStubControl.fromHandle(handle, impl));
- InputDispatcherStub.unbound([InputDispatcher impl])
- : super(new _InputDispatcherStubControl.unbound(impl));
-
static InputDispatcherStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For InputDispatcherStub"));
return new InputDispatcherStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _InputDispatcherStubControl.serviceDescription;
-
void dispatchEvent(input_events_mojom.Event event) {
return impl.dispatchEvent(event);

Powered by Google App Engine
This is Rietveld 408576698