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

Side by Side Diff: services/dart/lib/src/application.dart

Issue 816113004: Dart: Adds a content handler and a test. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « services/dart/lib/application.dart ('k') | services/dart/lib/src/service_provider.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 part of application;
6
7 // The Application interface doesn't explicitly have a Shell as a Client, but
8 // that is what is at the other end of the MessagePipe.
9 abstract class Application extends application.ApplicationInterface
10 with shell.ShellCalls {
11 List<service_provider.ServiceProviderClient> _clients;
12
13 Application(core.MojoMessagePipeEndpoint endpoint) :
14 _clients = [],
15 super(endpoint);
16
17 Application.fromHandle(core.MojoHandle shellHandle) :
18 _clients = [],
19 super.fromHandle(shellHandle);
20
21 Function interfaceFactoryClosure() => (endpoint) => null;
22
23 void initialize(List<String> args) {
24 }
25
26 void acceptConnection(
27 String requestorUrl,
28 service_provider.ServiceProviderInterface services,
29 service_provider.ServiceProviderClient exposedServices) {
30 var closure = interfaceFactoryClosure();
31 if (closure != null) {
32 var serviceProvider = new ServiceProvider(closure);
33 services.delegate = serviceProvider;
34 services.listen();
35 }
36 }
37
38 core.MojoMessagePipeEndpoint connectToService(String url, String service) {
39 var applicationPipe = new core.MojoMessagePipe();
40 var clientEndpoint = applicationPipe.endpoints[0];
41 var applicationEndpoint = applicationPipe.endpoints[1];
42 var serviceProviderClient =
43 new service_provider.ServiceProviderClient.unbound();
44 callConnectToApplication(url, serviceProviderClient, null);
45 serviceProviderClient.callConnectToService(service, applicationEndpoint);
46 _clients.add(serviceProviderClient);
47 return clientEndpoint;
48 }
49
50 void close() {
51 _clients.forEach((c) => c.close());
52 _clients.clear();
53 super.close();
54 }
55 }
OLDNEW
« no previous file with comments | « services/dart/lib/application.dart ('k') | services/dart/lib/src/service_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698