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

Side by Side Diff: sky/examples/dart-mojo.sky

Issue 922083002: Add initializeFromShellProxy to application.dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 #!mojo mojo:sky_viewer 1 #!mojo mojo:sky_viewer
2 <sky> 2 <sky>
3 <import src="dart-library.sky" as="library" /> 3 <import src="dart-library.sky" as="library" />
4 <script> 4 <script>
5 import 'dart:async'; 5 import 'dart:async';
6 import '/mojo/public/dart/application.dart'; 6 import '/mojo/public/dart/application.dart';
7 import 'dart:mojo_bindings'; 7 import 'dart:mojo_bindings';
8 import 'dart:mojo_core'; 8 import 'dart:mojo_core';
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 import 'dart:sky.internals' as internals; 10 import 'dart:sky.internals' as internals;
11 11
12 import 'package:mojo/services/network/public/interfaces/network_service.mojom.da rt'; 12 import 'package:mojo/services/network/public/interfaces/network_service.mojom.da rt';
13 import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart'; 13 import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart';
14 import 'package:mojo/public/interfaces/application/shell.mojom.dart' as shell_mo jom; 14 import 'package:mojo/public/interfaces/application/shell.mojom.dart' as shell_mo jom;
15 15
16 class WGet extends Application { 16 class WGet extends Application {
17 NetworkServiceProxy _networkService; 17 NetworkServiceProxy _networkService;
18 UrlLoaderProxy _urlLoaderProxy; 18 UrlLoaderProxy _urlLoaderProxy;
19 19
20 WGet.fromHandle(MojoHandle handle) : super.fromHandle(handle); 20 WGet.fromHandle(MojoHandle handle) : super.fromHandle(handle);
21 WGet(MojoMessagePipeEndpoint endpoint) : super(endpoint); 21 WGet(MojoMessagePipeEndpoint endpoint) : super(endpoint);
22 22
23 void initialize(List<String> args) { 23 void initialize(List<String> args, String url) {
24 run(args); 24 run(args);
25 } 25 }
26 26
27 run(List<String> args) async { 27 run(List<String> args) async {
28 if (args == null || args.length != 2) { 28 if (args == null || args.length != 2) {
29 throw "Expected URL argument"; 29 throw "Expected URL argument";
30 } 30 }
31 31
32 ByteData bodyData = await _getUrl(args[1]); 32 ByteData bodyData = await _getUrl(args[1]);
33 print("read ${bodyData.lengthInBytes} bytes"); 33 print("read ${bodyData.lengthInBytes} bytes");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 _networkService.close(); 67 _networkService.close();
68 _urlLoaderProxy = null; 68 _urlLoaderProxy = null;
69 _networkService = null; 69 _networkService = null;
70 } 70 }
71 } 71 }
72 72
73 main() { 73 main() {
74 var messagePipe = new MojoMessagePipe(); 74 var messagePipe = new MojoMessagePipe();
75 var wget = new WGet(messagePipe.endpoints[1]); 75 var wget = new WGet(messagePipe.endpoints[1]);
76 wget.listen(); 76 wget.listen();
77 var shellProxy = new shell_mojom.ShellProxy.fromHandle(new MojoHandle(internal s.passShellProxyHandle())); 77 var shellProxy = new shell_mojom.ShellProxy.fromHandle(new MojoHandle(internal s.passShellProxyHandle()));
zra 2015/02/13 07:14:23 If Dart code in .sky files should follow Dart styl
abarth-chromium 2015/02/13 07:16:50 Will fix.
78 wget.initializeFromShellProxy(shellProxy, ["mojo:wget", "http://www.google.com "]); 78 wget.initializeFromShellProxy(shellProxy, ["mojo:wget", "http://www.google.com "], "mojo:wget");
79 } 79 }
80 80
81 </script> 81 </script>
82 </sky> 82 </sky>
OLDNEW
« mojo/public/dart/src/application.dart ('K') | « mojo/public/dart/src/application.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698