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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/location_service.mojom.dart

Issue 1983453002: Dart: Refactor Stubs (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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library location_service_mojom; 5 library location_service_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 import 'package:mojo_services/mojo/location.mojom.dart' as location_mojom; 10 import 'package:mojo_services/mojo/location.mojom.dart' as location_mojom;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 dynamic getAllTypeDefinitions([Function responseFactory]) => 237 dynamic getAllTypeDefinitions([Function responseFactory]) =>
238 responseFactory(null); 238 responseFactory(null);
239 } 239 }
240 240
241 abstract class LocationService { 241 abstract class LocationService {
242 static const String serviceName = "mojo::LocationService"; 242 static const String serviceName = "mojo::LocationService";
243 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo nseFactory = null]); 243 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo nseFactory = null]);
244 } 244 }
245 245
246 246 class _LocationServiceProxyControl
247 class _LocationServiceProxyControl extends bindings.ProxyMessageHandler 247 extends bindings.ProxyMessageHandler
248 implements bindings.ProxyControl { 248 implements bindings.ProxyControl {
249 _LocationServiceProxyControl.fromEndpoint( 249 _LocationServiceProxyControl.fromEndpoint(
250 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 250 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
251 251
252 _LocationServiceProxyControl.fromHandle( 252 _LocationServiceProxyControl.fromHandle(
253 core.MojoHandle handle) : super.fromHandle(handle); 253 core.MojoHandle handle) : super.fromHandle(handle);
254 254
255 _LocationServiceProxyControl.unbound() : super.unbound(); 255 _LocationServiceProxyControl.unbound() : super.unbound();
256 256
257 service_describer.ServiceDescription get serviceDescription => 257 service_describer.ServiceDescription get serviceDescription =>
258 new _LocationServiceServiceDescription(); 258 new _LocationServiceServiceDescription();
259 259
260 String get serviceName => LocationService.serviceName; 260 String get serviceName => LocationService.serviceName;
261 261
262 @override
263 void handleResponse(bindings.ServiceMessage message) { 262 void handleResponse(bindings.ServiceMessage message) {
264 switch (message.header.type) { 263 switch (message.header.type) {
265 case _locationServiceMethodGetNextLocationName: 264 case _locationServiceMethodGetNextLocationName:
266 var r = LocationServiceGetNextLocationResponseParams.deserialize( 265 var r = LocationServiceGetNextLocationResponseParams.deserialize(
267 message.payload); 266 message.payload);
268 if (!message.header.hasRequestId) { 267 if (!message.header.hasRequestId) {
269 proxyError("Expected a message with a valid request Id."); 268 proxyError("Expected a message with a valid request Id.");
270 return; 269 return;
271 } 270 }
272 Completer c = completerMap[message.header.requestId]; 271 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
289 } 288 }
290 } 289 }
291 290
292 @override 291 @override
293 String toString() { 292 String toString() {
294 var superString = super.toString(); 293 var superString = super.toString();
295 return "_LocationServiceProxyControl($superString)"; 294 return "_LocationServiceProxyControl($superString)";
296 } 295 }
297 } 296 }
298 297
299 298 class LocationServiceProxy
300 class LocationServiceProxy extends bindings.Proxy 299 extends bindings.Proxy
301 implements LocationService { 300 implements LocationService {
302 LocationServiceProxy.fromEndpoint( 301 LocationServiceProxy.fromEndpoint(
303 core.MojoMessagePipeEndpoint endpoint) 302 core.MojoMessagePipeEndpoint endpoint)
304 : super(new _LocationServiceProxyControl.fromEndpoint(endpoint)); 303 : super(new _LocationServiceProxyControl.fromEndpoint(endpoint));
305 304
306 LocationServiceProxy.fromHandle(core.MojoHandle handle) 305 LocationServiceProxy.fromHandle(core.MojoHandle handle)
307 : super(new _LocationServiceProxyControl.fromHandle(handle)); 306 : super(new _LocationServiceProxyControl.fromHandle(handle));
308 307
309 LocationServiceProxy.unbound() 308 LocationServiceProxy.unbound()
310 : super(new _LocationServiceProxyControl.unbound()); 309 : super(new _LocationServiceProxyControl.unbound());
311 310
(...skipping 15 matching lines...) Expand all
327 var params = new _LocationServiceGetNextLocationParams(); 326 var params = new _LocationServiceGetNextLocationParams();
328 params.priority = priority; 327 params.priority = priority;
329 return ctrl.sendMessageWithRequestId( 328 return ctrl.sendMessageWithRequestId(
330 params, 329 params,
331 _locationServiceMethodGetNextLocationName, 330 _locationServiceMethodGetNextLocationName,
332 -1, 331 -1,
333 bindings.MessageHeader.kMessageExpectsResponse); 332 bindings.MessageHeader.kMessageExpectsResponse);
334 } 333 }
335 } 334 }
336 335
337 336 class _LocationServiceStubControl
338 class LocationServiceStub extends bindings.Stub { 337 extends bindings.StubMessageHandler
338 implements bindings.StubControl<LocationService> {
339 LocationService _impl; 339 LocationService _impl;
340 340
341 LocationServiceStub.fromEndpoint( 341 _LocationServiceStubControl.fromEndpoint(
342 core.MojoMessagePipeEndpoint endpoint, [LocationService impl]) 342 core.MojoMessagePipeEndpoint endpoint, [LocationService impl])
343 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 343 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
344 _impl = impl; 344 _impl = impl;
345 } 345 }
346 346
347 LocationServiceStub.fromHandle( 347 _LocationServiceStubControl.fromHandle(
348 core.MojoHandle handle, [LocationService impl]) 348 core.MojoHandle handle, [LocationService impl])
349 : super.fromHandle(handle, autoBegin: impl != null) { 349 : super.fromHandle(handle, autoBegin: impl != null) {
350 _impl = impl; 350 _impl = impl;
351 } 351 }
352 352
353 LocationServiceStub.unbound([this._impl]) : super.unbound(); 353 _LocationServiceStubControl.unbound([this._impl]) : super.unbound();
354
355 static LocationServiceStub newFromEndpoint(
356 core.MojoMessagePipeEndpoint endpoint) {
357 assert(endpoint.setDescription("For LocationServiceStub"));
358 return new LocationServiceStub.fromEndpoint(endpoint);
359 }
360 354
361 355
362 LocationServiceGetNextLocationResponseParams _locationServiceGetNextLocationRe sponseParamsFactory(location_mojom.Location location) { 356 LocationServiceGetNextLocationResponseParams _locationServiceGetNextLocationRe sponseParamsFactory(location_mojom.Location location) {
363 var result = new LocationServiceGetNextLocationResponseParams(); 357 var result = new LocationServiceGetNextLocationResponseParams();
364 result.location = location; 358 result.location = location;
365 return result; 359 return result;
366 } 360 }
367 361
368 dynamic handleMessage(bindings.ServiceMessage message) { 362 dynamic handleMessage(bindings.ServiceMessage message) {
369 if (bindings.ControlMessageHandler.isControlMessage(message)) { 363 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 410 }
417 411
418 @override 412 @override
419 void bind(core.MojoMessagePipeEndpoint endpoint) { 413 void bind(core.MojoMessagePipeEndpoint endpoint) {
420 super.bind(endpoint); 414 super.bind(endpoint);
421 if (!isOpen && (_impl != null)) { 415 if (!isOpen && (_impl != null)) {
422 beginHandlingEvents(); 416 beginHandlingEvents();
423 } 417 }
424 } 418 }
425 419
420 @override
426 String toString() { 421 String toString() {
427 var superString = super.toString(); 422 var superString = super.toString();
428 return "LocationServiceStub($superString)"; 423 return "_LocationServiceStubControl($superString)";
429 } 424 }
430 425
431 int get version => 0; 426 int get version => 0;
432 427
433 static service_describer.ServiceDescription _cachedServiceDescription; 428 static service_describer.ServiceDescription _cachedServiceDescription;
434 static service_describer.ServiceDescription get serviceDescription { 429 static service_describer.ServiceDescription get serviceDescription {
435 if (_cachedServiceDescription == null) { 430 if (_cachedServiceDescription == null) {
436 _cachedServiceDescription = new _LocationServiceServiceDescription(); 431 _cachedServiceDescription = new _LocationServiceServiceDescription();
437 } 432 }
438 return _cachedServiceDescription; 433 return _cachedServiceDescription;
439 } 434 }
440 } 435 }
441 436
437 class LocationServiceStub
438 extends bindings.Stub<LocationService>
439 implements LocationService {
440 LocationServiceStub.fromEndpoint(
441 core.MojoMessagePipeEndpoint endpoint, [LocationService impl])
442 : super(new _LocationServiceStubControl.fromEndpoint(endpoint, impl));
443
444 LocationServiceStub.fromHandle(
445 core.MojoHandle handle, [LocationService impl])
446 : super(new _LocationServiceStubControl.fromHandle(handle, impl));
447
448 LocationServiceStub.unbound([LocationService impl])
449 : super(new _LocationServiceStubControl.unbound(impl));
450
451 static LocationServiceStub newFromEndpoint(
452 core.MojoMessagePipeEndpoint endpoint) {
453 assert(endpoint.setDescription("For LocationServiceStub"));
454 return new LocationServiceStub.fromEndpoint(endpoint);
455 }
456
457 static service_describer.ServiceDescription get serviceDescription =>
458 _LocationServiceStubControl.serviceDescription;
459
460
461 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo nseFactory = null]) {
462 return impl.getNextLocation(priority,responseFactory);
463 }
464 }
465
442 466
443 467
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698