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

Unified Diff: content/shell/android/java/src/org/chromium/aura_content_shell/Shell.java

Issue 1469803006: NOT FOR REVIEW: Aura Android: Content Shell compiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_wthandroid
Patch Set: Temp Created 5 years 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: content/shell/android/java/src/org/chromium/aura_content_shell/Shell.java
diff --git a/content/shell/android/java/src/org/chromium/aura_content_shell/Shell.java b/content/shell/android/java/src/org/chromium/aura_content_shell/Shell.java
new file mode 100644
index 0000000000000000000000000000000000000000..7d09ed8addf337ce712f69630cd08becc01a4b4d
--- /dev/null
+++ b/content/shell/android/java/src/org/chromium/aura_content_shell/Shell.java
@@ -0,0 +1,78 @@
+// Copyright 2012 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.aura_content_shell;
+
+import android.app.Activity;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+
+// 1. Activity creates the Java Shell class, passes itself
+// 2. Shell.java saves Activity pointer
+// 3. Shell.java has a Java JNI method exposed to native to access the activity
+// 4, There's nativeInit or something which would link Java and CPP Shells
+// 5. Cpp Shell/shell_views can access the activity and pass it to the platform
+// window.
+
+/**
+ * Container for the various UI components that make up a shell window.
+ */
+@JNINamespace("content")
+public class Shell {
+
+// private WebContents mWebContents;
+// private NavigationController mNavigationController;
+
+ private long mNativeShell;
+ private Activity mContentShellActivity;
+
+ /**
+ * Constructor for inflating via XML.
+ */
+ public Shell(Activity activity) {
+ mContentShellActivity = activity;
+ nativeInit(this);
+ }
+
+ /**
+ * Initializes the Shell for use.
+ *
+ * @param nativeShell The pointer to the native Shell object.
+ */
+ public void initialize(long nativeShell) {
+ mNativeShell = nativeShell;
+ }
+
+ /**
+ * Closes the shell and cleans up the native instance, which will handle destroying all
+ * dependencies.
+ */
+ public void close() {
+ if (mNativeShell == 0) return;
+ nativeCloseShell(mNativeShell);
+ }
+
+ @CalledByNative
+ private void onNativeDestroyed() {
+ mNativeShell = 0;
+ }
+
+ @CalledByNative
+ private Object getActivity() {
+ assert mContentShellActivity != null;
+ return mContentShellActivity;
+ }
+
+ /**
+ * @return Whether the Shell has been destroyed.
+ * @see #onNativeDestroyed()
+ */
+ public boolean isDestroyed() {
+ return mNativeShell == 0;
+ }
+
+ private static native void nativeCloseShell(long shellPtr);
+ private static native void nativeInit(Object shellInstance);
+}

Powered by Google App Engine
This is Rietveld 408576698