| OLD | NEW |
| 1 #!mojo mojo:dart_content_handler | 1 #!mojo mojo:dart_content_handler |
| 2 // Copyright 2015 The Chromium Authors. All rights reserved. | 2 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 | 7 |
| 8 import 'package:mojo/application.dart'; | 8 import 'package:mojo/application.dart'; |
| 9 import 'package:mojo/bindings.dart'; | 9 import 'package:mojo/bindings.dart'; |
| 10 import 'package:mojo/core.dart'; | 10 import 'package:mojo/core.dart'; |
| 11 import 'package:mojo_services/mojo/device_info.mojom.dart'; | 11 import 'package:mojo_services/mojo/device_info.mojom.dart'; |
| 12 | 12 |
| 13 class DeviceInfoApp extends Application { | 13 class DeviceInfoApp extends Application { |
| 14 final DeviceInfoProxy _deviceInfo = new DeviceInfoProxy.unbound(); | 14 final DeviceInfoProxy _deviceInfo = new DeviceInfoProxy.unbound(); |
| 15 | 15 |
| 16 DeviceInfoApp.fromHandle(MojoHandle handle) : super.fromHandle(handle); | 16 DeviceInfoApp.fromHandle(MojoHandle handle) : super.fromHandle(handle); |
| 17 | 17 |
| 18 Future initialize(List<String> args, String url) async { | 18 Future initialize(List<String> args, String url) async { |
| 19 connectToService("mojo:device_info", _deviceInfo); | 19 connectToService("mojo:device_info", _deviceInfo); |
| 20 print(await _deviceInfo.getDeviceType()); | 20 var c = new Completer(); |
| 21 _deviceInfo.getDeviceType((DeviceInfoDeviceType type) { |
| 22 c.complete(type); |
| 23 }); |
| 24 print(await _deviceInfo.responseOrError(c.future)); |
| 21 _deviceInfo.close(); | 25 _deviceInfo.close(); |
| 22 close(); | 26 close(); |
| 23 } | 27 } |
| 24 } | 28 } |
| 25 | 29 |
| 26 main(List args, Object handleToken) { | 30 main(List args, Object handleToken) { |
| 27 MojoHandle appHandle = new MojoHandle(handleToken); | 31 MojoHandle appHandle = new MojoHandle(handleToken); |
| 28 new DeviceInfoApp.fromHandle(appHandle); | 32 new DeviceInfoApp.fromHandle(appHandle); |
| 29 } | 33 } |
| OLD | NEW |