OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 import "/mojo/public/dart/application.dart"; | |
6 import "dart:mojo_bindings" as bindings; | |
7 import "dart:mojo_core" as core; | |
8 import "dart:sky.internals" as internals; | |
9 import "package:mojo/public/interfaces/application/service_provider.mojom.dart"; | |
10 import "package:mojo/public/interfaces/application/shell.mojom.dart"; | |
11 | |
12 final embedder = new EmbedderImpl(); | |
abarth-chromium
2015/02/20 22:51:38
Type pls
hansmuller1
2015/02/20 22:58:54
Done.
| |
13 | |
14 class EmbedderImpl { | |
abarth-chromium
2015/02/20 22:51:38
EmbedderImpl -> _EmbedderImpl to hide the class.
hansmuller1
2015/02/20 22:58:54
Done.
| |
15 final connections = new List<ApplicationConnection>(); | |
abarth-chromium
2015/02/20 22:51:38
Type pls
hansmuller1
2015/02/20 22:58:54
I removed the field; it shouldn't have been there.
| |
16 var _shell; | |
abarth-chromium
2015/02/20 22:51:38
Type pls
hansmuller1
2015/02/20 22:58:54
Done.
| |
17 | |
18 ShellProxy shell() { | |
abarth-chromium
2015/02/20 22:51:38
This should be a getter.
Actually, if you make _s
hansmuller1
2015/02/20 22:58:54
Done.
| |
19 if (_shell == null) | |
20 _shell = new ShellProxy.fromHandle( | |
21 new core.MojoHandle(internals.takeShellProxyHandle())); | |
abarth-chromium
2015/02/20 22:51:38
You can do this as an initializer for _shell if yo
hansmuller1
2015/02/20 22:58:54
Done.
| |
22 return _shell; | |
23 } | |
24 | |
25 ApplicationConnection connectToApplication(String url) { | |
26 var proxy = new ServiceProviderProxy.unbound(); | |
27 var stub = new ServiceProviderStub.unbound(); | |
28 shell().connectToApplication(url, proxy, stub); | |
29 return new ApplicationConnection(stub, proxy); | |
30 } | |
31 | |
32 void connectToService(String url, bindings.Proxy proxy) { | |
33 var appSp = new ServiceProviderProxy.unbound(); | |
34 shell().connectToApplication(url, appSp, null); | |
35 var pipe = new core.MojoMessagePipe(); | |
36 proxy.bind(pipe.endpoints[0]); | |
37 appSp.connectToService(proxy.name, pipe.endpoints[1]); | |
38 appSp.close(); | |
39 } | |
40 } | |
OLD | NEW |