Adam Barth ec0a8e615c Sky should expose services provided to/by embedder
These now appear on internals as takeServicesProvidedToEmbedder and
takeServicesProvidedByEmbedder. When you call these functions, you get back the
raw int that represents the handle. We'll need to wrap them up inside the Dart
VM with the appropriate types. We can create a nice wrapper for that in a
future CL.

R=hansmuller@google.com, hansmuller@chromium.org

Review URL: https://codereview.chromium.org/944733002
2015-02-19 21:16:04 -08:00

24 lines
957 B
Dart

// Copyright 2015 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.
import "/mojo/public/dart/application.dart";
import "dart:mojo_bindings" as bindings;
import "dart:mojo_core" as core;
import "dart:sky.internals" as internals;
import "package:mojo/public/interfaces/application/service_provider.mojom.dart";
import "package:mojo/public/interfaces/application/shell.mojom.dart";
final ShellProxy _shell = new ShellProxy.fromHandle(
new core.MojoHandle(internals.takeShellProxyHandle()));
ApplicationConnection connectToApplication(String url) {
var serviceProviderProxy = new ServiceProviderProxy.unbound();
_shell.connectToApplication(url, serviceProviderProxy, null);
return new ApplicationConnection(null, serviceProviderProxy);
}
void connectToService(String url, bindings.Proxy proxy) {
connectToApplication(url).requestService(proxy);
}