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

Unified Diff: sky/examples/dart-mojo.sky

Issue 919883002: Allow sky apps to be consumers of mojo services (Closed) Base URL: https://github.com/eseidel/skydart.git@master
Patch Set: cr comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/dart.sky ('k') | sky/viewer/internals.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/dart-mojo.sky
diff --git a/examples/dart/wget/main.dart b/sky/examples/dart-mojo.sky
similarity index 73%
copy from examples/dart/wget/main.dart
copy to sky/examples/dart-mojo.sky
index 5898695e486613f2a8bed0dc353e53fd6c21946d..e69f99e1d0429026db6a947d99401d0f5bfb2f0e 100644
--- a/examples/dart/wget/main.dart
+++ b/sky/examples/dart-mojo.sky
@@ -1,24 +1,24 @@
-// 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) {
run(args);
@@ -70,9 +70,13 @@ class WGet extends Application {
}
}
-main(List args) {
- MojoHandle appHandle = new MojoHandle(args[0]);
- String url = args[1];
- 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>
« no previous file with comments | « sky/examples/dart.sky ('k') | sky/viewer/internals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698