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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/geocoder.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/geocoder.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/geocoder.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/geocoder.mojom.dart
index 88bc5f64e26b4dbd6c26c966c69512ee6595e156..a5b8139a67978dfb95de74ebe02e6ca95dae5b30 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/geocoder.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/geocoder.mojom.dart
@@ -1100,13 +1100,51 @@ class _GeocoderServiceDescription implements service_describer.ServiceDescriptio
abstract class Geocoder {
static const String serviceName = null;
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _GeocoderServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static GeocoderProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ GeocoderProxy p = new GeocoderProxy.unbound();
+ String name = serviceName ?? Geocoder.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 addressToLocation(String address,Options options,[Function responseFactory = null]);
dynamic locationToAddress(location_mojom.Location location,Options options,[Function responseFactory = null]);
}
+abstract class GeocoderInterface
+ implements bindings.MojoInterface<Geocoder>,
+ Geocoder {
+ factory GeocoderInterface([Geocoder impl]) =>
+ new GeocoderStub.unbound(impl);
+ factory GeocoderInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [Geocoder impl]) =>
+ new GeocoderStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class GeocoderInterfaceRequest
+ implements bindings.MojoInterface<Geocoder>,
+ Geocoder {
+ factory GeocoderInterfaceRequest() =>
+ new GeocoderProxy.unbound();
+}
+
class _GeocoderProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<Geocoder> {
_GeocoderProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -1115,9 +1153,6 @@ class _GeocoderProxyControl
_GeocoderProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _GeocoderServiceDescription();
-
String get serviceName => Geocoder.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -1169,6 +1204,11 @@ class _GeocoderProxyControl
}
}
+ Geocoder get impl => null;
+ set impl(Geocoder _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -1177,8 +1217,10 @@ class _GeocoderProxyControl
}
class GeocoderProxy
- extends bindings.Proxy
- implements Geocoder {
+ extends bindings.Proxy<Geocoder>
+ implements Geocoder,
+ GeocoderInterface,
+ GeocoderInterfaceRequest {
GeocoderProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _GeocoderProxyControl.fromEndpoint(endpoint));
@@ -1195,13 +1237,6 @@ class GeocoderProxy
return new GeocoderProxy.fromEndpoint(endpoint);
}
- factory GeocoderProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- GeocoderProxy p = new GeocoderProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
dynamic addressToLocation(String address,Options options,[Function responseFactory = null]) {
var params = new _GeocoderAddressToLocationParams();
@@ -1244,6 +1279,8 @@ class _GeocoderStubControl
_GeocoderStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => Geocoder.serviceName;
+
GeocoderAddressToLocationResponseParams _geocoderAddressToLocationResponseParamsFactory(String status, List<Result> results) {
var result = new GeocoderAddressToLocationResponseParams();
@@ -1345,19 +1382,16 @@ class _GeocoderStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _GeocoderServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class GeocoderStub
extends bindings.Stub<Geocoder>
- implements Geocoder {
+ implements Geocoder,
+ GeocoderInterface,
+ GeocoderInterfaceRequest {
+ GeocoderStub.unbound([Geocoder impl])
+ : super(new _GeocoderStubControl.unbound(impl));
+
GeocoderStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [Geocoder impl])
: super(new _GeocoderStubControl.fromEndpoint(endpoint, impl));
@@ -1366,18 +1400,12 @@ class GeocoderStub
core.MojoHandle handle, [Geocoder impl])
: super(new _GeocoderStubControl.fromHandle(handle, impl));
- GeocoderStub.unbound([Geocoder impl])
- : super(new _GeocoderStubControl.unbound(impl));
-
static GeocoderStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For GeocoderStub"));
return new GeocoderStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _GeocoderStubControl.serviceDescription;
-
dynamic addressToLocation(String address,Options options,[Function responseFactory = null]) {
return impl.addressToLocation(address,options,responseFactory);

Powered by Google App Engine
This is Rietveld 408576698