Index: sky/examples/dart-mojo.sky |
diff --git a/examples/dart/wget/main.dart b/sky/examples/dart-mojo.sky |
similarity index 72% |
copy from examples/dart/wget/main.dart |
copy to sky/examples/dart-mojo.sky |
index d5130634b973fa4ec9419a568e48216d59ef1f55..e69f99e1d0429026db6a947d99401d0f5bfb2f0e 100644 |
--- a/examples/dart/wget/main.dart |
+++ b/sky/examples/dart-mojo.sky |
@@ -1,26 +1,26 @@ |
-// Copyright 2014 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-// Run with, e.g.: |
-// mojo_shell "mojo:dart_wget http://www.google.com" |
- |
+#!mojo mojo:sky_viewer |
+<sky> |
+<import src="dart-library.sky" as="library" /> |
+<script> |
import 'dart:async'; |
-import 'dart:mojo_application'; |
+import '/mojo/public/dart/application.dart'; |
import 'dart:mojo_bindings'; |
import 'dart:mojo_core'; |
import 'dart:typed_data'; |
+import 'dart:sky.internals' as internals; |
import 'package:mojo/services/network/public/interfaces/network_service.mojom.dart'; |
import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart'; |
+import 'package:mojo/public/interfaces/application/shell.mojom.dart' as shell_mojom; |
class WGet extends Application { |
NetworkServiceProxy _networkService; |
UrlLoaderProxy _urlLoaderProxy; |
WGet.fromHandle(MojoHandle handle) : super.fromHandle(handle); |
+ WGet(MojoMessagePipeEndpoint endpoint) : super(endpoint); |
- void initialize(List<String> args, String url) { |
+ void initialize(List<String> args) { |
run(args); |
} |
@@ -70,8 +70,13 @@ class WGet extends Application { |
} |
} |
-main(List args) { |
- MojoHandle appHandle = new MojoHandle(args[0]); |
- var wget = new WGet.fromHandle(appHandle); |
+main() { |
+ var messagePipe = new MojoMessagePipe(); |
+ var wget = new WGet(messagePipe.endpoints[1]); |
wget.listen(); |
+ var shellProxy = new shell_mojom.ShellProxy.fromHandle(new MojoHandle(internals.passShellProxyHandle())); |
+ wget.initializeFromShellProxy(shellProxy, ["mojo:wget", "http://www.google.com"]); |
} |
+ |
+</script> |
+</sky> |