OLD | NEW |
1 #!mojo mojo:dart_content_handler | 1 #!mojo mojo:dart_content_handler |
2 | 2 |
3 // Copyright 2014 The Chromium Authors. All rights reserved. | 3 // Copyright 2014 The Chromium Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style license that can be | 4 // Use of this source code is governed by a BSD-style license that can be |
5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:mojo_application'; | 8 import 'dart:mojo_application'; |
9 import 'dart:mojo_bindings'; | 9 import 'dart:mojo_bindings'; |
10 import 'dart:mojo_core'; | 10 import 'dart:mojo_core'; |
11 import 'dart:typed_data'; | 11 import 'dart:typed_data'; |
12 | 12 |
13 import 'package:mojo/services/network/public/interfaces/network_service.mojom.da
rt'; | 13 import 'package:mojo/services/network/public/interfaces/network_service.mojom.da
rt'; |
14 import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart'; | 14 import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart'; |
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 shellHandle) : super.fromHandle(shellHandle); | 20 WGet.fromHandle(MojoHandle handle) : super.fromHandle(handle); |
| 21 |
| 22 // This Application provides no services. |
| 23 Function stubFactoryClosure() => (endpoint) => null; |
21 | 24 |
22 void initialize(List<String> args) { | 25 void initialize(List<String> args) { |
23 run(args); | 26 run(args); |
24 } | 27 } |
25 | 28 |
26 run(List<String> args) async { | 29 run(List<String> args) async { |
27 if (args.length != 2) { | 30 if (args.length != 2) { |
28 throw "Expected URL argument"; | 31 throw "Expected URL argument"; |
29 } | 32 } |
30 | 33 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 66 |
64 void _closeProxies() { | 67 void _closeProxies() { |
65 _urlLoaderProxy.close(); | 68 _urlLoaderProxy.close(); |
66 _networkService.close(); | 69 _networkService.close(); |
67 _urlLoaderProxy = null; | 70 _urlLoaderProxy = null; |
68 _networkService = null; | 71 _networkService = null; |
69 } | 72 } |
70 } | 73 } |
71 | 74 |
72 main(List args) { | 75 main(List args) { |
73 MojoHandle shellHandle = new MojoHandle(args[0]); | 76 MojoHandle appHandle = new MojoHandle(args[0]); |
74 String url = args[1]; | 77 String url = args[1]; |
75 var wget = new WGet.fromHandle(shellHandle); | 78 var wget = new WGet.fromHandle(appHandle); |
76 wget.listen(); | 79 wget.listen(); |
77 } | 80 } |
OLD | NEW |