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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/dart/lib/src/application.dart
diff --git a/services/dart/lib/src/application.dart b/services/dart/lib/src/application.dart
new file mode 100644
index 0000000000000000000000000000000000000000..dde4808500b6c1fb20a99294e56cdd8a6fd51096
--- /dev/null
+++ b/services/dart/lib/src/application.dart
@@ -0,0 +1,55 @@
+// Copyright 2014 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.
+
+part of application;
+
+// The Application interface doesn't explicitly have a Shell as a Client, but
+// that is what is at the other end of the MessagePipe.
+abstract class Application extends application.ApplicationInterface
+ with shell.ShellCalls {
+ List<service_provider.ServiceProviderClient> _clients;
+
+ Application(core.MojoMessagePipeEndpoint endpoint) :
+ _clients = [],
+ super(endpoint);
+
+ Application.fromHandle(core.MojoHandle shellHandle) :
+ _clients = [],
+ super.fromHandle(shellHandle);
+
+ Function interfaceFactoryClosure() => (endpoint) => null;
+
+ void initialize(List<String> args) {
+ }
+
+ void acceptConnection(
+ String requestorUrl,
+ service_provider.ServiceProviderInterface services,
+ service_provider.ServiceProviderClient exposedServices) {
+ var closure = interfaceFactoryClosure();
+ if (closure != null) {
+ var serviceProvider = new ServiceProvider(closure);
+ services.delegate = serviceProvider;
+ services.listen();
+ }
+ }
+
+ core.MojoMessagePipeEndpoint connectToService(String url, String service) {
+ var applicationPipe = new core.MojoMessagePipe();
+ var clientEndpoint = applicationPipe.endpoints[0];
+ var applicationEndpoint = applicationPipe.endpoints[1];
+ var serviceProviderClient =
+ new service_provider.ServiceProviderClient.unbound();
+ callConnectToApplication(url, serviceProviderClient, null);
+ serviceProviderClient.callConnectToService(service, applicationEndpoint);
+ _clients.add(serviceProviderClient);
+ return clientEndpoint;
+ }
+
+ void close() {
+ _clients.forEach((c) => c.close());
+ _clients.clear();
+ super.close();
+ }
+}
« 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