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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/device_info.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 device_info_mojom; 5 library device_info_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 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 dynamic getAllTypeDefinitions([Function responseFactory]) => 242 dynamic getAllTypeDefinitions([Function responseFactory]) =>
243 responseFactory(null); 243 responseFactory(null);
244 } 244 }
245 245
246 abstract class DeviceInfo { 246 abstract class DeviceInfo {
247 static const String serviceName = "mojo::DeviceInfo"; 247 static const String serviceName = "mojo::DeviceInfo";
248 dynamic getDeviceType([Function responseFactory = null]); 248 dynamic getDeviceType([Function responseFactory = null]);
249 } 249 }
250 250
251 251 class _DeviceInfoProxyControl
252 class _DeviceInfoProxyControl extends bindings.ProxyMessageHandler 252 extends bindings.ProxyMessageHandler
253 implements bindings.ProxyControl { 253 implements bindings.ProxyControl {
254 _DeviceInfoProxyControl.fromEndpoint( 254 _DeviceInfoProxyControl.fromEndpoint(
255 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 255 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
256 256
257 _DeviceInfoProxyControl.fromHandle( 257 _DeviceInfoProxyControl.fromHandle(
258 core.MojoHandle handle) : super.fromHandle(handle); 258 core.MojoHandle handle) : super.fromHandle(handle);
259 259
260 _DeviceInfoProxyControl.unbound() : super.unbound(); 260 _DeviceInfoProxyControl.unbound() : super.unbound();
261 261
262 service_describer.ServiceDescription get serviceDescription => 262 service_describer.ServiceDescription get serviceDescription =>
263 new _DeviceInfoServiceDescription(); 263 new _DeviceInfoServiceDescription();
264 264
265 String get serviceName => DeviceInfo.serviceName; 265 String get serviceName => DeviceInfo.serviceName;
266 266
267 @override
268 void handleResponse(bindings.ServiceMessage message) { 267 void handleResponse(bindings.ServiceMessage message) {
269 switch (message.header.type) { 268 switch (message.header.type) {
270 case _deviceInfoMethodGetDeviceTypeName: 269 case _deviceInfoMethodGetDeviceTypeName:
271 var r = DeviceInfoGetDeviceTypeResponseParams.deserialize( 270 var r = DeviceInfoGetDeviceTypeResponseParams.deserialize(
272 message.payload); 271 message.payload);
273 if (!message.header.hasRequestId) { 272 if (!message.header.hasRequestId) {
274 proxyError("Expected a message with a valid request Id."); 273 proxyError("Expected a message with a valid request Id.");
275 return; 274 return;
276 } 275 }
277 Completer c = completerMap[message.header.requestId]; 276 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
294 } 293 }
295 } 294 }
296 295
297 @override 296 @override
298 String toString() { 297 String toString() {
299 var superString = super.toString(); 298 var superString = super.toString();
300 return "_DeviceInfoProxyControl($superString)"; 299 return "_DeviceInfoProxyControl($superString)";
301 } 300 }
302 } 301 }
303 302
304 303 class DeviceInfoProxy
305 class DeviceInfoProxy extends bindings.Proxy 304 extends bindings.Proxy
306 implements DeviceInfo { 305 implements DeviceInfo {
307 DeviceInfoProxy.fromEndpoint( 306 DeviceInfoProxy.fromEndpoint(
308 core.MojoMessagePipeEndpoint endpoint) 307 core.MojoMessagePipeEndpoint endpoint)
309 : super(new _DeviceInfoProxyControl.fromEndpoint(endpoint)); 308 : super(new _DeviceInfoProxyControl.fromEndpoint(endpoint));
310 309
311 DeviceInfoProxy.fromHandle(core.MojoHandle handle) 310 DeviceInfoProxy.fromHandle(core.MojoHandle handle)
312 : super(new _DeviceInfoProxyControl.fromHandle(handle)); 311 : super(new _DeviceInfoProxyControl.fromHandle(handle));
313 312
314 DeviceInfoProxy.unbound() 313 DeviceInfoProxy.unbound()
315 : super(new _DeviceInfoProxyControl.unbound()); 314 : super(new _DeviceInfoProxyControl.unbound());
316 315
(...skipping 14 matching lines...) Expand all
331 dynamic getDeviceType([Function responseFactory = null]) { 330 dynamic getDeviceType([Function responseFactory = null]) {
332 var params = new _DeviceInfoGetDeviceTypeParams(); 331 var params = new _DeviceInfoGetDeviceTypeParams();
333 return ctrl.sendMessageWithRequestId( 332 return ctrl.sendMessageWithRequestId(
334 params, 333 params,
335 _deviceInfoMethodGetDeviceTypeName, 334 _deviceInfoMethodGetDeviceTypeName,
336 -1, 335 -1,
337 bindings.MessageHeader.kMessageExpectsResponse); 336 bindings.MessageHeader.kMessageExpectsResponse);
338 } 337 }
339 } 338 }
340 339
341 340 class _DeviceInfoStubControl
342 class DeviceInfoStub extends bindings.Stub { 341 extends bindings.StubMessageHandler
342 implements bindings.StubControl<DeviceInfo> {
343 DeviceInfo _impl; 343 DeviceInfo _impl;
344 344
345 DeviceInfoStub.fromEndpoint( 345 _DeviceInfoStubControl.fromEndpoint(
346 core.MojoMessagePipeEndpoint endpoint, [DeviceInfo impl]) 346 core.MojoMessagePipeEndpoint endpoint, [DeviceInfo impl])
347 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 347 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
348 _impl = impl; 348 _impl = impl;
349 } 349 }
350 350
351 DeviceInfoStub.fromHandle( 351 _DeviceInfoStubControl.fromHandle(
352 core.MojoHandle handle, [DeviceInfo impl]) 352 core.MojoHandle handle, [DeviceInfo impl])
353 : super.fromHandle(handle, autoBegin: impl != null) { 353 : super.fromHandle(handle, autoBegin: impl != null) {
354 _impl = impl; 354 _impl = impl;
355 } 355 }
356 356
357 DeviceInfoStub.unbound([this._impl]) : super.unbound(); 357 _DeviceInfoStubControl.unbound([this._impl]) : super.unbound();
358
359 static DeviceInfoStub newFromEndpoint(
360 core.MojoMessagePipeEndpoint endpoint) {
361 assert(endpoint.setDescription("For DeviceInfoStub"));
362 return new DeviceInfoStub.fromEndpoint(endpoint);
363 }
364 358
365 359
366 DeviceInfoGetDeviceTypeResponseParams _deviceInfoGetDeviceTypeResponseParamsFa ctory(DeviceInfoDeviceType deviceType) { 360 DeviceInfoGetDeviceTypeResponseParams _deviceInfoGetDeviceTypeResponseParamsFa ctory(DeviceInfoDeviceType deviceType) {
367 var result = new DeviceInfoGetDeviceTypeResponseParams(); 361 var result = new DeviceInfoGetDeviceTypeResponseParams();
368 result.deviceType = deviceType; 362 result.deviceType = deviceType;
369 return result; 363 return result;
370 } 364 }
371 365
372 dynamic handleMessage(bindings.ServiceMessage message) { 366 dynamic handleMessage(bindings.ServiceMessage message) {
373 if (bindings.ControlMessageHandler.isControlMessage(message)) { 367 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 412 }
419 413
420 @override 414 @override
421 void bind(core.MojoMessagePipeEndpoint endpoint) { 415 void bind(core.MojoMessagePipeEndpoint endpoint) {
422 super.bind(endpoint); 416 super.bind(endpoint);
423 if (!isOpen && (_impl != null)) { 417 if (!isOpen && (_impl != null)) {
424 beginHandlingEvents(); 418 beginHandlingEvents();
425 } 419 }
426 } 420 }
427 421
422 @override
428 String toString() { 423 String toString() {
429 var superString = super.toString(); 424 var superString = super.toString();
430 return "DeviceInfoStub($superString)"; 425 return "_DeviceInfoStubControl($superString)";
431 } 426 }
432 427
433 int get version => 0; 428 int get version => 0;
434 429
435 static service_describer.ServiceDescription _cachedServiceDescription; 430 static service_describer.ServiceDescription _cachedServiceDescription;
436 static service_describer.ServiceDescription get serviceDescription { 431 static service_describer.ServiceDescription get serviceDescription {
437 if (_cachedServiceDescription == null) { 432 if (_cachedServiceDescription == null) {
438 _cachedServiceDescription = new _DeviceInfoServiceDescription(); 433 _cachedServiceDescription = new _DeviceInfoServiceDescription();
439 } 434 }
440 return _cachedServiceDescription; 435 return _cachedServiceDescription;
441 } 436 }
442 } 437 }
443 438
439 class DeviceInfoStub
440 extends bindings.Stub<DeviceInfo>
441 implements DeviceInfo {
442 DeviceInfoStub.fromEndpoint(
443 core.MojoMessagePipeEndpoint endpoint, [DeviceInfo impl])
444 : super(new _DeviceInfoStubControl.fromEndpoint(endpoint, impl));
445
446 DeviceInfoStub.fromHandle(
447 core.MojoHandle handle, [DeviceInfo impl])
448 : super(new _DeviceInfoStubControl.fromHandle(handle, impl));
449
450 DeviceInfoStub.unbound([DeviceInfo impl])
451 : super(new _DeviceInfoStubControl.unbound(impl));
452
453 static DeviceInfoStub newFromEndpoint(
454 core.MojoMessagePipeEndpoint endpoint) {
455 assert(endpoint.setDescription("For DeviceInfoStub"));
456 return new DeviceInfoStub.fromEndpoint(endpoint);
457 }
458
459 static service_describer.ServiceDescription get serviceDescription =>
460 _DeviceInfoStubControl.serviceDescription;
461
462
463 dynamic getDeviceType([Function responseFactory = null]) {
464 return impl.getDeviceType(responseFactory);
465 }
466 }
467
444 468
445 469
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698