OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.SearchManager; | 9 import android.app.SearchManager; |
10 import android.content.ClipboardManager; | 10 import android.content.ClipboardManager; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 private float mCurrentTouchOffsetY; | 354 private float mCurrentTouchOffsetY; |
355 | 355 |
356 // Offsets for smart clip | 356 // Offsets for smart clip |
357 private int mSmartClipOffsetX; | 357 private int mSmartClipOffsetX; |
358 private int mSmartClipOffsetY; | 358 private int mSmartClipOffsetY; |
359 | 359 |
360 // Whether the ContentViewCore requires the WebContents to be fullscreen in order to lock the | 360 // Whether the ContentViewCore requires the WebContents to be fullscreen in order to lock the |
361 // screen orientation. | 361 // screen orientation. |
362 private boolean mFullscreenRequiredForOrientationLock = true; | 362 private boolean mFullscreenRequiredForOrientationLock = true; |
363 | 363 |
364 // The accelerated view for fullscreen video playback. | |
365 private ContentVideoView mVideoView; | |
no sievers
2014/10/10 02:15:25
Can you avoid holding this ref here?
Ignacio Solla
2014/10/10 09:23:41
To avoid holding this ref we would need to return
Ignacio Solla
2014/10/10 09:25:50
Please ignore this comment, I have published it by
| |
366 | |
364 /** | 367 /** |
365 * Constructs a new ContentViewCore. Embedders must call initialize() after constructing | 368 * Constructs a new ContentViewCore. Embedders must call initialize() after constructing |
366 * a ContentViewCore and before using it. | 369 * a ContentViewCore and before using it. |
367 * | 370 * |
368 * @param context The context used to create this. | 371 * @param context The context used to create this. |
369 */ | 372 */ |
370 public ContentViewCore(Context context) { | 373 public ContentViewCore(Context context) { |
371 mContext = context; | 374 mContext = context; |
372 | 375 |
373 mAdapterInputConnectionFactory = new AdapterInputConnectionFactory(); | 376 mAdapterInputConnectionFactory = new AdapterInputConnectionFactory(); |
(...skipping 12 matching lines...) Expand all Loading... | |
386 mGestureStateListeners = new ObserverList<GestureStateListener>(); | 389 mGestureStateListeners = new ObserverList<GestureStateListener>(); |
387 mGestureStateListenersIterator = mGestureStateListeners.rewindableIterat or(); | 390 mGestureStateListenersIterator = mGestureStateListeners.rewindableIterat or(); |
388 | 391 |
389 mEditable = Editable.Factory.getInstance().newEditable(""); | 392 mEditable = Editable.Factory.getInstance().newEditable(""); |
390 Selection.setSelection(mEditable, 0); | 393 Selection.setSelection(mEditable, 0); |
391 } | 394 } |
392 | 395 |
393 /** | 396 /** |
394 * @return The context used for creating this ContentViewCore. | 397 * @return The context used for creating this ContentViewCore. |
395 */ | 398 */ |
396 @CalledByNative | |
397 public Context getContext() { | 399 public Context getContext() { |
398 return mContext; | 400 return mContext; |
399 } | 401 } |
400 | 402 |
401 /** | 403 /** |
402 * @return The ViewGroup that all view actions of this ContentViewCore shoul d interact with. | 404 * @return The ViewGroup that all view actions of this ContentViewCore shoul d interact with. |
403 */ | 405 */ |
404 public ViewGroup getContainerView() { | 406 public ViewGroup getContainerView() { |
405 return mContainerView; | 407 return mContainerView; |
406 } | 408 } |
(...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2771 * Sets whether or not we should set accessibility focus on page load. | 2773 * Sets whether or not we should set accessibility focus on page load. |
2772 * This only applies if an accessibility service like TalkBack is running. | 2774 * This only applies if an accessibility service like TalkBack is running. |
2773 * This is desirable behavior for a browser window, but not for an embedded | 2775 * This is desirable behavior for a browser window, but not for an embedded |
2774 * WebView. | 2776 * WebView. |
2775 */ | 2777 */ |
2776 public void setShouldSetAccessibilityFocusOnPageLoad(boolean on) { | 2778 public void setShouldSetAccessibilityFocusOnPageLoad(boolean on) { |
2777 mShouldSetAccessibilityFocusOnPageLoad = on; | 2779 mShouldSetAccessibilityFocusOnPageLoad = on; |
2778 } | 2780 } |
2779 | 2781 |
2780 /** | 2782 /** |
2781 * Inform WebKit that Fullscreen mode has been exited by the user. | 2783 * Inform WebKit that Fullscreen mode has been exited by the user |
2784 * or the app (in the case of the WebView). | |
2782 */ | 2785 */ |
2783 public void exitFullscreen() { | 2786 public void exitFullscreen() { |
2784 assert mWebContents != null; | 2787 assert mWebContents != null; |
2785 mWebContents.exitFullscreen(); | 2788 mWebContents.exitFullscreen(); |
2786 } | 2789 } |
2787 | 2790 |
2788 /** | 2791 /** |
2792 * The {@link ContentVideoView} that must be shown when the {@link #onDidEnt erFullscreen()} | |
2793 * callback is received. | |
2794 */ | |
2795 void setContentVideoView(ContentVideoView videoView) { | |
2796 mVideoView = videoView; | |
2797 } | |
2798 | |
2799 @CalledByNative | |
2800 private void onDidEnterFullscreen() { | |
2801 if (mVideoView != null) { | |
2802 getContentVideoViewClient().enterFullscreenVideo(mVideoView); | |
2803 } else { | |
2804 getContentViewClient().enterFullscreen(); | |
2805 } | |
2806 } | |
2807 | |
2808 @CalledByNative | |
2809 private void onDidExitFullscreen() { | |
2810 if (mVideoView != null) { | |
2811 getContentVideoViewClient().exitFullscreenVideo(); | |
2812 mVideoView = null; | |
2813 } else { | |
2814 getContentViewClient().exitFullscreen(); | |
2815 } | |
2816 } | |
2817 | |
2818 /** | |
2789 * Changes whether hiding the top controls is enabled. | 2819 * Changes whether hiding the top controls is enabled. |
2790 * | 2820 * |
2791 * @param enableHiding Whether hiding the top controls should be enabled or not. | 2821 * @param enableHiding Whether hiding the top controls should be enabled or not. |
2792 * @param enableShowing Whether showing the top controls should be enabled o r not. | 2822 * @param enableShowing Whether showing the top controls should be enabled o r not. |
2793 * @param animate Whether the transition should be animated or not. | 2823 * @param animate Whether the transition should be animated or not. |
2794 */ | 2824 */ |
2795 public void updateTopControlsState(boolean enableHiding, boolean enableShowi ng, | 2825 public void updateTopControlsState(boolean enableHiding, boolean enableShowi ng, |
2796 boolean animate) { | 2826 boolean animate) { |
2797 assert mWebContents != null; | 2827 assert mWebContents != null; |
2798 mWebContents.updateTopControlsState( | 2828 mWebContents.updateTopControlsState( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2885 mTouchScrollInProgress = false; | 2915 mTouchScrollInProgress = false; |
2886 mPotentiallyActiveFlingCount = 0; | 2916 mPotentiallyActiveFlingCount = 0; |
2887 | 2917 |
2888 if (touchScrollInProgress) updateGestureStateListener(GestureEventType.S CROLL_END); | 2918 if (touchScrollInProgress) updateGestureStateListener(GestureEventType.S CROLL_END); |
2889 if (potentiallyActiveFlingCount > 0) updateGestureStateListener(GestureE ventType.FLING_END); | 2919 if (potentiallyActiveFlingCount > 0) updateGestureStateListener(GestureE ventType.FLING_END); |
2890 } | 2920 } |
2891 | 2921 |
2892 private native long nativeInit(long webContentsPtr, | 2922 private native long nativeInit(long webContentsPtr, |
2893 long viewAndroidPtr, long windowAndroidPtr, HashSet<Object> retained ObjectSet); | 2923 long viewAndroidPtr, long windowAndroidPtr, HashSet<Object> retained ObjectSet); |
2894 | 2924 |
2895 @CalledByNative | 2925 ContentVideoViewClient getContentVideoViewClient() { |
2896 private ContentVideoViewClient getContentVideoViewClient() { | |
2897 return getContentViewClient().getContentVideoViewClient(); | 2926 return getContentViewClient().getContentVideoViewClient(); |
2898 } | 2927 } |
2899 | 2928 |
2900 @CalledByNative | 2929 @CalledByNative |
2901 private boolean shouldBlockMediaRequest(String url) { | 2930 private boolean shouldBlockMediaRequest(String url) { |
2902 return getContentViewClient().shouldBlockMediaRequest(url); | 2931 return getContentViewClient().shouldBlockMediaRequest(url); |
2903 } | 2932 } |
2904 | 2933 |
2905 @CalledByNative | 2934 @CalledByNative |
2906 private void onNativeFlingStopped() { | 2935 private void onNativeFlingStopped() { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3034 private native void nativeWasResized(long nativeContentViewCoreImpl); | 3063 private native void nativeWasResized(long nativeContentViewCoreImpl); |
3035 | 3064 |
3036 private native void nativeSetAccessibilityEnabled( | 3065 private native void nativeSetAccessibilityEnabled( |
3037 long nativeContentViewCoreImpl, boolean enabled); | 3066 long nativeContentViewCoreImpl, boolean enabled); |
3038 | 3067 |
3039 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, | 3068 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, |
3040 int x, int y, int w, int h); | 3069 int x, int y, int w, int h); |
3041 | 3070 |
3042 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); | 3071 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); |
3043 } | 3072 } |
OLD | NEW |