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.ptr.getDeviceType()); | 20 print(await _deviceInfo.getDeviceType()); |
21 _deviceInfo.close(); | 21 _deviceInfo.close(); |
22 close(); | 22 close(); |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 main(List args, Object handleToken) { | 26 main(List args, Object handleToken) { |
27 MojoHandle appHandle = new MojoHandle(handleToken); | 27 MojoHandle appHandle = new MojoHandle(handleToken); |
28 new DeviceInfoApp.fromHandle(appHandle); | 28 new DeviceInfoApp.fromHandle(appHandle); |
29 } | 29 } |
OLD | NEW |