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

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: comment 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
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
abarth-chromium 2015/01/18 22:19:02 The way we've been naming things in C++ is to have
abarth-chromium 2015/01/18 22:19:02 The way we've been naming things in C++ is to have
zra 2015/01/20 17:36:51 Added TODO in the interface template.
10 with shell.ShellCalls {
abarth-chromium 2015/01/18 22:19:02 What is ShellCalls?
zra 2015/01/20 17:36:51 I have (partly) implemented Client= using Dart mix
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();
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 serviceProvider = new ServiceProvider(interfaceFactoryClosure());
31 services.delegate = serviceProvider;
32 services.listen();
33 }
34
35 core.MojoMessagePipeEndpoint connectToService(String url, String service) {
36 var applicationPipe = new core.MojoMessagePipe();
37 var clientEndpoint = applicationPipe.endpoints[0];
38 var applicationEndpoint = applicationPipe.endpoints[1];
39 var serviceProviderClient =
40 new service_provider.ServiceProviderClient.unbound();
41 callConnectToApplication(url, serviceProviderClient, null);
abarth-chromium 2015/01/18 22:19:02 callConnectToApplication ? Why not connectToAppli
zra 2015/01/20 17:36:51 This is more cruftiness related to Client=. Since
42 serviceProviderClient.callConnectToService(service, applicationEndpoint);
43 _clients.add(serviceProviderClient);
44 return clientEndpoint;
45 }
46
47 void close() {
48 _clients.forEach((c) => c.close());
49 _clients.clear();
50 super.close();
51 }
52 }
53
54
55 // TODO(zra): Is this generally useful? If not remove.
56 // A ClientApplication is a Mojo Application that does not provide any
57 // services (does not implement any interfaces).
abarth-chromium 2015/01/18 22:19:02 I'd remove this. We don't have this concept in th
zra 2015/01/20 17:36:51 Done.
58 abstract class ClientApplication extends Application {
59 ClientApplication(core.MojoMessagePipeEndpoint endpoint) : super(endpoint);
60
61 ClientApplication.fromHandle(core.MojoHandle shellHandle) :
62 super.fromHandle(shellHandle);
63
64 Function interfaceFactoryClosure() => () => null;
65
66 void initialize(List<String> args) {
67 run(args);
68 }
69
70 void acceptConnection(
71 String requestorUrl,
72 service_provider.ServiceProviderInterface services,
73 service_provider.ServiceProviderClient exposedServices) {
74 }
75
76 run(List<String> args) async;
77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698