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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/navigation.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/navigation.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/navigation.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/navigation.mojom.dart
index f932ea2a6c4fabb24a26536d4e3237effe6fdb1e..f6dd735b72133d0f212a37b05e85a0685d9a358f 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/navigation.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/navigation.mojom.dart
@@ -319,14 +319,52 @@ class _NavigatorHostServiceDescription implements service_describer.ServiceDescr
abstract class NavigatorHost {
static const String serviceName = "mojo::NavigatorHost";
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _NavigatorHostServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static NavigatorHostProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ NavigatorHostProxy p = new NavigatorHostProxy.unbound();
+ String name = serviceName ?? NavigatorHost.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 requestNavigate(Target target, url_request_mojom.UrlRequest request);
void requestNavigateHistory(int delta);
void didNavigateLocally(String url);
}
+abstract class NavigatorHostInterface
+ implements bindings.MojoInterface<NavigatorHost>,
+ NavigatorHost {
+ factory NavigatorHostInterface([NavigatorHost impl]) =>
+ new NavigatorHostStub.unbound(impl);
+ factory NavigatorHostInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [NavigatorHost impl]) =>
+ new NavigatorHostStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class NavigatorHostInterfaceRequest
+ implements bindings.MojoInterface<NavigatorHost>,
+ NavigatorHost {
+ factory NavigatorHostInterfaceRequest() =>
+ new NavigatorHostProxy.unbound();
+}
+
class _NavigatorHostProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<NavigatorHost> {
_NavigatorHostProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -335,9 +373,6 @@ class _NavigatorHostProxyControl
_NavigatorHostProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _NavigatorHostServiceDescription();
-
String get serviceName => NavigatorHost.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -349,6 +384,11 @@ class _NavigatorHostProxyControl
}
}
+ NavigatorHost get impl => null;
+ set impl(NavigatorHost _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -357,8 +397,10 @@ class _NavigatorHostProxyControl
}
class NavigatorHostProxy
- extends bindings.Proxy
- implements NavigatorHost {
+ extends bindings.Proxy<NavigatorHost>
+ implements NavigatorHost,
+ NavigatorHostInterface,
+ NavigatorHostInterfaceRequest {
NavigatorHostProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _NavigatorHostProxyControl.fromEndpoint(endpoint));
@@ -375,13 +417,6 @@ class NavigatorHostProxy
return new NavigatorHostProxy.fromEndpoint(endpoint);
}
- factory NavigatorHostProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- NavigatorHostProxy p = new NavigatorHostProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
void requestNavigate(Target target, url_request_mojom.UrlRequest request) {
if (!ctrl.isBound) {
@@ -435,6 +470,8 @@ class _NavigatorHostStubControl
_NavigatorHostStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => NavigatorHost.serviceName;
+
dynamic handleMessage(bindings.ServiceMessage message) {
@@ -495,19 +532,16 @@ class _NavigatorHostStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _NavigatorHostServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class NavigatorHostStub
extends bindings.Stub<NavigatorHost>
- implements NavigatorHost {
+ implements NavigatorHost,
+ NavigatorHostInterface,
+ NavigatorHostInterfaceRequest {
+ NavigatorHostStub.unbound([NavigatorHost impl])
+ : super(new _NavigatorHostStubControl.unbound(impl));
+
NavigatorHostStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [NavigatorHost impl])
: super(new _NavigatorHostStubControl.fromEndpoint(endpoint, impl));
@@ -516,18 +550,12 @@ class NavigatorHostStub
core.MojoHandle handle, [NavigatorHost impl])
: super(new _NavigatorHostStubControl.fromHandle(handle, impl));
- NavigatorHostStub.unbound([NavigatorHost impl])
- : super(new _NavigatorHostStubControl.unbound(impl));
-
static NavigatorHostStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For NavigatorHostStub"));
return new NavigatorHostStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _NavigatorHostStubControl.serviceDescription;
-
void requestNavigate(Target target, url_request_mojom.UrlRequest request) {
return impl.requestNavigate(target, request);

Powered by Google App Engine
This is Rietveld 408576698