Chromium Code Reviews| 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; |
| + } |
| +} |