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 "dart:sky.internals" as internals; | |
6 import "embedder.dart"; | |
7 import "package:mojo/public/dart/application.dart"; | |
8 import 'package:mojo/public/dart/core.dart' as core; | |
9 import "package:mojom/mojo/service_provider.mojom.dart"; | |
10 | |
11 ApplicationConnection _initConnection() { | |
12 int rawHandle = internals.takeServicesProvidedByEmbedder(); | |
13 core.MojoHandle proxyHandle = new core.MojoHandle(rawHandle); | |
14 ServiceProviderProxy serviceProvider = null; | |
15 if (proxyHandle.isValid) serviceProvider = | |
16 new ServiceProviderProxy.fromHandle(proxyHandle); | |
17 return new ApplicationConnection(null, serviceProvider); | |
18 } | |
19 | |
20 final ApplicationConnection _connection = _initConnection(); | |
21 | |
22 void requestService(String url, Object proxy) { | |
23 if (embedder.shell == null) _connection.requestService(proxy); | |
24 else embedder.connectToService(url, proxy); | |
25 } | |
OLD | NEW |