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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 // here. One for which the provisional load is commited will hav
e the strong binding | 711 // here. One for which the provisional load is commited will hav
e the strong binding |
712 // removed in navigationEntryCommitted() below. | 712 // removed in navigationEntryCommitted() below. |
713 if (isProvisionalLoad) determinedProcessVisibility(); | 713 if (isProvisionalLoad) determinedProcessVisibility(); |
714 } | 714 } |
715 | 715 |
716 @Override | 716 @Override |
717 public void didNavigateMainFrame(String url, String baseUrl, | 717 public void didNavigateMainFrame(String url, String baseUrl, |
718 boolean isNavigationToDifferentPage, boolean isFragmentNavig
ation) { | 718 boolean isNavigationToDifferentPage, boolean isFragmentNavig
ation) { |
719 if (!isNavigationToDifferentPage) return; | 719 if (!isNavigationToDifferentPage) return; |
720 hidePopupsAndClearSelection(); | 720 hidePopupsAndClearSelection(); |
| 721 if (mNativeContentViewCore != 0) nativeResetPendingInput(mNative
ContentViewCore); |
721 resetScrollInProgress(); | 722 resetScrollInProgress(); |
722 resetGestureDetection(); | |
723 } | 723 } |
724 | 724 |
725 @Override | 725 @Override |
726 public void renderProcessGone(boolean wasOomProtected) { | 726 public void renderProcessGone(boolean wasOomProtected) { |
727 hidePopupsAndClearSelection(); | 727 hidePopupsAndClearSelection(); |
728 resetScrollInProgress(); | 728 resetScrollInProgress(); |
729 // No need to reset gesture detection as the detector will have | 729 // No need to reset gesture detection as the detector will have |
730 // been destroyed in the RenderWidgetHostView. | 730 // been destroyed in the RenderWidgetHostView. |
731 } | 731 } |
732 | 732 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 // actions have no corresponding WebTouchEvent type and may confuse the | 1100 // actions have no corresponding WebTouchEvent type and may confuse the |
1101 // touch pipline, so we ignore them entirely. | 1101 // touch pipline, so we ignore them entirely. |
1102 return eventAction == MotionEvent.ACTION_DOWN | 1102 return eventAction == MotionEvent.ACTION_DOWN |
1103 || eventAction == MotionEvent.ACTION_UP | 1103 || eventAction == MotionEvent.ACTION_UP |
1104 || eventAction == MotionEvent.ACTION_CANCEL | 1104 || eventAction == MotionEvent.ACTION_CANCEL |
1105 || eventAction == MotionEvent.ACTION_MOVE | 1105 || eventAction == MotionEvent.ACTION_MOVE |
1106 || eventAction == MotionEvent.ACTION_POINTER_DOWN | 1106 || eventAction == MotionEvent.ACTION_POINTER_DOWN |
1107 || eventAction == MotionEvent.ACTION_POINTER_UP; | 1107 || eventAction == MotionEvent.ACTION_POINTER_UP; |
1108 } | 1108 } |
1109 | 1109 |
1110 public void setIgnoreRemainingTouchEvents() { | |
1111 resetGestureDetection(); | |
1112 } | |
1113 | |
1114 public boolean isScrollInProgress() { | 1110 public boolean isScrollInProgress() { |
1115 return mTouchScrollInProgress || mPotentiallyActiveFlingCount > 0; | 1111 return mTouchScrollInProgress || mPotentiallyActiveFlingCount > 0; |
1116 } | 1112 } |
1117 | 1113 |
1118 @SuppressWarnings("unused") | 1114 @SuppressWarnings("unused") |
1119 @CalledByNative | 1115 @CalledByNative |
1120 private void onFlingStartEventConsumed(int vx, int vy) { | 1116 private void onFlingStartEventConsumed(int vx, int vy) { |
1121 mTouchScrollInProgress = false; | 1117 mTouchScrollInProgress = false; |
1122 mPotentiallyActiveFlingCount++; | 1118 mPotentiallyActiveFlingCount++; |
1123 for (mGestureStateListenersIterator.rewind(); | 1119 for (mGestureStateListenersIterator.rewind(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 if (mActionMode != null) { | 1338 if (mActionMode != null) { |
1343 mActionMode.finish(); | 1339 mActionMode.finish(); |
1344 mActionMode = null; | 1340 mActionMode = null; |
1345 } | 1341 } |
1346 } | 1342 } |
1347 | 1343 |
1348 public boolean isSelectActionBarShowing() { | 1344 public boolean isSelectActionBarShowing() { |
1349 return mActionMode != null; | 1345 return mActionMode != null; |
1350 } | 1346 } |
1351 | 1347 |
1352 private void resetGestureDetection() { | |
1353 if (mNativeContentViewCore == 0) return; | |
1354 nativeResetGestureDetection(mNativeContentViewCore); | |
1355 } | |
1356 | |
1357 /** | 1348 /** |
1358 * @see View#onAttachedToWindow() | 1349 * @see View#onAttachedToWindow() |
1359 */ | 1350 */ |
1360 @SuppressWarnings("javadoc") | 1351 @SuppressWarnings("javadoc") |
1361 public void onAttachedToWindow() { | 1352 public void onAttachedToWindow() { |
1362 setAccessibilityState(mAccessibilityManager.isEnabled()); | 1353 setAccessibilityState(mAccessibilityManager.isEnabled()); |
1363 restoreSelectionPopupsIfNecessary(); | 1354 restoreSelectionPopupsIfNecessary(); |
1364 ScreenOrientationListener.getInstance().addObserver(this, mContext); | 1355 ScreenOrientationListener.getInstance().addObserver(this, mContext); |
1365 GamepadList.onAttachedToWindow(mContext); | 1356 GamepadList.onAttachedToWindow(mContext); |
1366 } | 1357 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 private void cancelRequestToScrollFocusedEditableNodeIntoView() { | 1491 private void cancelRequestToScrollFocusedEditableNodeIntoView() { |
1501 // Zero-ing the rect will prevent |updateAfterSizeChanged()| from | 1492 // Zero-ing the rect will prevent |updateAfterSizeChanged()| from |
1502 // issuing the delayed form focus event. | 1493 // issuing the delayed form focus event. |
1503 mFocusPreOSKViewportRect.setEmpty(); | 1494 mFocusPreOSKViewportRect.setEmpty(); |
1504 } | 1495 } |
1505 | 1496 |
1506 /** | 1497 /** |
1507 * @see View#onWindowFocusChanged(boolean) | 1498 * @see View#onWindowFocusChanged(boolean) |
1508 */ | 1499 */ |
1509 public void onWindowFocusChanged(boolean hasWindowFocus) { | 1500 public void onWindowFocusChanged(boolean hasWindowFocus) { |
1510 if (!hasWindowFocus) resetGestureDetection(); | 1501 if (!hasWindowFocus) { |
| 1502 if (mNativeContentViewCore == 0) return; |
| 1503 nativeCancelActiveTouchSequence(mNativeContentViewCore); |
| 1504 } |
1511 } | 1505 } |
1512 | 1506 |
1513 public void onFocusChanged(boolean gainFocus) { | 1507 public void onFocusChanged(boolean gainFocus) { |
1514 if (gainFocus) { | 1508 if (gainFocus) { |
1515 restoreSelectionPopupsIfNecessary(); | 1509 restoreSelectionPopupsIfNecessary(); |
1516 } else { | 1510 } else { |
1517 hideImeIfNeeded(); | 1511 hideImeIfNeeded(); |
1518 cancelRequestToScrollFocusedEditableNodeIntoView(); | 1512 cancelRequestToScrollFocusedEditableNodeIntoView(); |
1519 if (mPreserveSelectionOnNextLossOfFocus) { | 1513 if (mPreserveSelectionOnNextLossOfFocus) { |
1520 mPreserveSelectionOnNextLossOfFocus = false; | 1514 mPreserveSelectionOnNextLossOfFocus = false; |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2993 private native void nativePinchBy(long nativeContentViewCoreImpl, long timeM
s, | 2987 private native void nativePinchBy(long nativeContentViewCoreImpl, long timeM
s, |
2994 float anchorX, float anchorY, float deltaScale); | 2988 float anchorX, float anchorY, float deltaScale); |
2995 | 2989 |
2996 private native void nativeSelectBetweenCoordinates( | 2990 private native void nativeSelectBetweenCoordinates( |
2997 long nativeContentViewCoreImpl, float x1, float y1, float x2, float
y2); | 2991 long nativeContentViewCoreImpl, float x1, float y1, float x2, float
y2); |
2998 | 2992 |
2999 private native void nativeMoveCaret(long nativeContentViewCoreImpl, float x,
float y); | 2993 private native void nativeMoveCaret(long nativeContentViewCoreImpl, float x,
float y); |
3000 | 2994 |
3001 private native void nativeHideTextHandles(long nativeContentViewCoreImpl); | 2995 private native void nativeHideTextHandles(long nativeContentViewCoreImpl); |
3002 | 2996 |
3003 private native void nativeResetGestureDetection(long nativeContentViewCoreIm
pl); | 2997 private native void nativeCancelActiveTouchSequence(long nativeContentViewCo
reImpl); |
| 2998 |
| 2999 private native void nativeResetPendingInput(long nativeContentViewCoreImpl); |
3004 | 3000 |
3005 private native void nativeSetDoubleTapSupportEnabled( | 3001 private native void nativeSetDoubleTapSupportEnabled( |
3006 long nativeContentViewCoreImpl, boolean enabled); | 3002 long nativeContentViewCoreImpl, boolean enabled); |
3007 | 3003 |
3008 private native void nativeSetMultiTouchZoomSupportEnabled( | 3004 private native void nativeSetMultiTouchZoomSupportEnabled( |
3009 long nativeContentViewCoreImpl, boolean enabled); | 3005 long nativeContentViewCoreImpl, boolean enabled); |
3010 | 3006 |
3011 private native void nativeSelectPopupMenuItems(long nativeContentViewCoreImp
l, | 3007 private native void nativeSelectPopupMenuItems(long nativeContentViewCoreImp
l, |
3012 long nativeSelectPopupSourceFrame, int[] indices); | 3008 long nativeSelectPopupSourceFrame, int[] indices); |
3013 | 3009 |
(...skipping 14 matching lines...) Expand all Loading... |
3028 private native void nativeWasResized(long nativeContentViewCoreImpl); | 3024 private native void nativeWasResized(long nativeContentViewCoreImpl); |
3029 | 3025 |
3030 private native void nativeSetAccessibilityEnabled( | 3026 private native void nativeSetAccessibilityEnabled( |
3031 long nativeContentViewCoreImpl, boolean enabled); | 3027 long nativeContentViewCoreImpl, boolean enabled); |
3032 | 3028 |
3033 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3029 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3034 int x, int y, int w, int h); | 3030 int x, int y, int w, int h); |
3035 | 3031 |
3036 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); | 3032 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); |
3037 } | 3033 } |
OLD | NEW |