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

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: 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
Index: sky/examples/dart-mojo.sky
diff --git a/examples/dart/wget/main.dart b/sky/examples/dart-mojo.sky
similarity index 74%
copy from examples/dart/wget/main.dart
copy to sky/examples/dart-mojo.sky
index 5898695e486613f2a8bed0dc353e53fd6c21946d..e1b3a4f22b4c12067d34ae94c54e9116da680ab2 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 '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';
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,14 @@ 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 appProxy = new ApplicationProxy(messagePipe.endpoints[0]);
abarth-chromium 2015/02/12 03:29:33 We can just delete this line
rafaelw 2015/02/12 18:54:55 Done.
+ var wget = new WGet(messagePipe.endpoints[1]);
zra 2015/02/12 04:01:45 This looks a bit scary to me. I'd like to understa
rafaelw 2015/02/12 18:54:55 This is just an example file. We'll soon follow up
wget.listen();
+ var shellProxy = new ShellProxy.fromHandle(new MojoHandle(internals.passShellProxyHandle()));
+ wget.initializeFromShellProxy(shellProxy, ["mojo:wget", "http://www.google.com"]);
}
+
+</script>
+</sky>

Powered by Google App Engine
This is Rietveld 408576698