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

Unified Diff: blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/BlimpView.java

Issue 2270323004: Add BlimpView to a Chrome tab when Blimp is enabled. (Closed)
Patch Set: Magic now happens Created 4 years, 4 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: blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/BlimpView.java
diff --git a/blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/BlimpView.java b/blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/BlimpView.java
new file mode 100644
index 0000000000000000000000000000000000000000..1b67efb9f8c2d4739d4d971a5237c2b4fc99af21
--- /dev/null
+++ b/blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/BlimpView.java
@@ -0,0 +1,55 @@
+// Copyright 2016 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.blimp.core.contents;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.FrameLayout;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.ui.base.WindowAndroid;
+
+/**
+ * A {@link View} that will visually represent the Blimp rendered content.
+ */
+@JNINamespace("blimp::client")
+public class BlimpView extends FrameLayout {
+ @CalledByNative
+ private static BlimpView create(
+ long nativeBlimpView, WindowAndroid window, BlimpContentsImpl blimpContentsImpl) {
+ Context context = window.getContext().get();
+ if (context == null) throw new AssertionError("WindowAndroid must have a valid context.");
+ return new BlimpView(nativeBlimpView, context, blimpContentsImpl);
+ }
+
+ private long mNativeBlimpViewPtr;
+
+ private BlimpContentsImpl mBlimpContentsImpl;
+
+ /**
+ * Builds a new {@link BlimpView}.
+ * @param context A {@link Context} instance.
+ * @param blimpContentsImpl The {@link BlimpContentsImpl} this BlimpView is used for.
+ */
+ private BlimpView(long nativeBlimpView, Context context, BlimpContentsImpl blimpContentsImpl) {
+ super(context);
+ setFocusable(true);
+ setFocusableInTouchMode(true);
+ mNativeBlimpViewPtr = nativeBlimpView;
+ mBlimpContentsImpl = blimpContentsImpl;
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ // TODO(nyquist): Pipe to TabControlFeature.
David Trainor- moved to gerrit 2016/08/29 05:29:33 also onTouchEvent! :)
nyquist 2016/08/29 19:09:19 Done.
+ }
+
+ @CalledByNative
+ public void clearNativePtr() {
+ mNativeBlimpViewPtr = 0;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698