| OLD | NEW |
| 1 #!mojo mojo:dart_content_handler | 1 #!mojo mojo:dart_content_handler |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 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 import 'dart:core'; | 7 import 'dart:core'; |
| 8 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
| 9 | 9 |
| 10 import 'package:mojo/application.dart'; | 10 import 'package:mojo/application.dart'; |
| 11 import 'package:mojo/bindings.dart'; | 11 import 'package:mojo/bindings.dart'; |
| 12 import 'package:mojo/core.dart'; | 12 import 'package:mojo/core.dart'; |
| 13 import 'package:mojo/mojo/network_error.mojom.dart'; | 13 import 'package:mojo/mojo/network_error.mojom.dart'; |
| 14 import 'package:mojo_services/mojo/files/file.mojom.dart' as files; | 14 import 'package:mojo_services/mojo/files/file.mojom.dart' as files; |
| 15 import 'package:mojo_services/mojo/files/types.mojom.dart' as files; | 15 import 'package:mojo_services/mojo/files/types.mojom.dart' as files; |
| 16 import 'package:mojo_services/mojo/net_address.mojom.dart'; | 16 import 'package:mojo_services/mojo/net_address.mojom.dart'; |
| 17 import 'package:mojo_services/mojo/network_service.mojom.dart'; | 17 import 'package:mojo_services/mojo/network_service.mojom.dart'; |
| 18 import 'package:mojo_services/mojo/tcp_bound_socket.mojom.dart'; | 18 import 'package:mojo_services/mojo/tcp_bound_socket.mojom.dart'; |
| 19 import 'package:mojo_services/mojo/tcp_connected_socket.mojom.dart'; | 19 import 'package:mojo_services/mojo/tcp_connected_socket.mojom.dart'; |
| 20 import 'package:mojo_services/mojo/terminal/terminal_client.mojom.dart'; | 20 import 'package:mojo_services/mojo/terminal/terminal_client.mojom.dart'; |
| 21 | 21 |
| 22 void ignoreFuture(Future f) { | 22 void ignoreFuture(Future f) { |
| 23 f.catchError((e) {}); | 23 f.catchError((e) {}); |
| 24 } | 24 } |
| 25 | 25 |
| 26 NetAddress makeIPv4NetAddress(List<int> addr, int port) { | 26 NetAddress makeIPv4NetAddress(List<int> addr, int port) { |
| 27 var rv = new NetAddress(); | 27 var rv = new NetAddress(); |
| 28 rv.family = NetAddressFamily.ipV4; | 28 rv.family = NetAddressFamily.ipv4; |
| 29 rv.ipv4 = new NetAddressIPv4(); | 29 rv.ipv4 = new NetAddressIPv4(); |
| 30 rv.ipv4.addr = new List<int>.from(addr); | 30 rv.ipv4.addr = new List<int>.from(addr); |
| 31 rv.ipv4.port = port; | 31 rv.ipv4.port = port; |
| 32 return rv; | 32 return rv; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void fputs(files.File f, String s) { | 35 void fputs(files.File f, String s) { |
| 36 ignoreFuture(f.write((s + '\n').codeUnits, 0, files.Whence.fromCurrent)); | 36 ignoreFuture(f.write((s + '\n').codeUnits, 0, files.Whence.fromCurrent)); |
| 37 } | 37 } |
| 38 | 38 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 233 } |
| 234 | 234 |
| 235 main(List args) { | 235 main(List args) { |
| 236 MojoHandle appHandle = new MojoHandle(args[0]); | 236 MojoHandle appHandle = new MojoHandle(args[0]); |
| 237 String url = args[1]; | 237 String url = args[1]; |
| 238 new NetcatApplication.fromHandle(appHandle) | 238 new NetcatApplication.fromHandle(appHandle) |
| 239 ..onError = ((Object e) { | 239 ..onError = ((Object e) { |
| 240 MojoHandle.reportLeakedHandles(); | 240 MojoHandle.reportLeakedHandles(); |
| 241 }); | 241 }); |
| 242 } | 242 } |
| OLD | NEW |