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

Unified Diff: shell/android/apk/src/org/chromium/mojo/shell/AndroidFactory.java

Issue 1468913003: Add android.mojo application. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 1 month 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 | « shell/BUILD.gn ('k') | shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/android/apk/src/org/chromium/mojo/shell/AndroidFactory.java
diff --git a/shell/android/apk/src/org/chromium/mojo/shell/AndroidFactory.java b/shell/android/apk/src/org/chromium/mojo/shell/AndroidFactory.java
new file mode 100644
index 0000000000000000000000000000000000000000..f3a34c0936b29a3d0b933dde4d233604123e04fe
--- /dev/null
+++ b/shell/android/apk/src/org/chromium/mojo/shell/AndroidFactory.java
@@ -0,0 +1,29 @@
+// 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.shell;
+
+import org.chromium.mojo.android.ActivityImpl;
+import org.chromium.mojo.application.ServiceFactoryBinder;
+import org.chromium.mojo.bindings.InterfaceRequest;
+import org.chromium.mojom.activity.Activity;
+
+/**
+ * A ServiceFactoryBinder for the android service.
+ */
+final class AndroidFactory implements ServiceFactoryBinder<Activity> {
+ @Override
+ public void bind(final InterfaceRequest<Activity> request) {
+ if (ViewportActivity.getCurrent() == null) {
+ request.close();
+ return;
+ }
+ Activity.MANAGER.bind(new ActivityImpl(ViewportActivity.getCurrent()), request);
+ }
+
+ @Override
+ public String getInterfaceName() {
+ return Activity.MANAGER.getName();
+ }
+}
« no previous file with comments | « shell/BUILD.gn ('k') | shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698