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

Unified Diff: third_party/mojo/src/mojo/public/java/application/src/org/chromium/mojo/application/ApplicationImpl.java

Issue 975973002: Update mojo sdk to rev f68e697e389943cd9bf9652397312280e96b127a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shake fist at msvc Created 5 years, 10 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
Index: third_party/mojo/src/mojo/public/java/application/src/org/chromium/mojo/application/ApplicationImpl.java
diff --git a/third_party/mojo/src/mojo/public/java/application/src/org/chromium/mojo/application/ApplicationImpl.java b/third_party/mojo/src/mojo/public/java/application/src/org/chromium/mojo/application/ApplicationImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..2676f38dc67fc83b49baaf14d6b6a8a422b3c9ca
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/java/application/src/org/chromium/mojo/application/ApplicationImpl.java
@@ -0,0 +1,72 @@
+// 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.
+
+package org.chromium.mojo.application;
+
+import org.chromium.mojo.bindings.InterfaceRequest;
+import org.chromium.mojo.system.Core;
+import org.chromium.mojo.system.MessagePipeHandle;
+import org.chromium.mojo.system.MojoException;
+import org.chromium.mojom.mojo.Application;
+import org.chromium.mojom.mojo.ServiceProvider;
+import org.chromium.mojom.mojo.Shell;
+
+import java.util.ArrayList;
+
+/**
+ * Utility class for communicating with the Shell, and provide Services to clients.
+ */
+class ApplicationImpl implements Application {
+ private final ApplicationDelegate mApplicationDelegate;
+ private final ArrayList<ApplicationConnection> mIncomingConnections =
+ new ArrayList<ApplicationConnection>();
+ private final Core mCore;
+ private Shell mShell;
+
+ public ApplicationImpl(
+ ApplicationDelegate delegate, Core core, MessagePipeHandle applicationRequest) {
+ mApplicationDelegate = delegate;
+ mCore = core;
+ ApplicationImpl.MANAGER.bind(this, applicationRequest);
+ }
+
+ @Override
+ public void initialize(Shell shell, String[] args, String url) {
+ mShell = shell;
+ mApplicationDelegate.initialize(shell, args, url);
+ }
+
+ @Override
+ public void acceptConnection(String requestorUrl, InterfaceRequest<ServiceProvider> services,
+ ServiceProvider exposedServices, String connectionUrl) {
+ ApplicationConnection connection =
+ new ApplicationConnection(requestorUrl, exposedServices, connectionUrl);
+ if (services != null
+ && mApplicationDelegate.configureIncomingConnection(requestorUrl, connection)) {
+ ServiceProvider.MANAGER.bind(connection.getLocalServiceProvider(), services);
+ mIncomingConnections.add(connection);
+ } else {
+ connection.close();
+ }
+ }
+
+ @Override
+ public void requestQuit() {
+ mApplicationDelegate.quit();
+ for (ApplicationConnection connection : mIncomingConnections) {
+ connection.close();
+ }
+ mCore.getCurrentRunLoop().quit();
+ }
+
+ @Override
+ public void close() {
+ if (mShell != null) {
+ mShell.close();
+ }
+ }
+
+ @Override
+ public void onConnectionError(MojoException e) {}
+}

Powered by Google App Engine
This is Rietveld 408576698