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

Side by Side Diff: examples/dart/device_info/lib/main.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 6 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
« no previous file with comments | « benchmarks/mojo_rtt_benchmark/lib/main.dart ('k') | examples/dart/echo_client/lib/main.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 }
OLDNEW
« no previous file with comments | « benchmarks/mojo_rtt_benchmark/lib/main.dart ('k') | examples/dart/echo_client/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698