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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 // Only valid when focused on a text / password field. | 286 // Only valid when focused on a text / password field. |
287 private ImeAdapter mImeAdapter; | 287 private ImeAdapter mImeAdapter; |
288 private ImeAdapter.AdapterInputConnectionFactory mAdapterInputConnectionFact
ory; | 288 private ImeAdapter.AdapterInputConnectionFactory mAdapterInputConnectionFact
ory; |
289 private AdapterInputConnection mInputConnection; | 289 private AdapterInputConnection mInputConnection; |
290 private InputMethodManagerWrapper mInputMethodManagerWrapper; | 290 private InputMethodManagerWrapper mInputMethodManagerWrapper; |
291 | 291 |
292 // Lazily created paste popup menu, triggered either via long press in an | 292 // Lazily created paste popup menu, triggered either via long press in an |
293 // editable region or from tapping the insertion handle. | 293 // editable region or from tapping the insertion handle. |
294 private PastePopupMenu mPastePopupMenu; | 294 private PastePopupMenu mPastePopupMenu; |
| 295 private boolean mWasPastePopupShowingOnInsertionDragStart; |
295 | 296 |
296 private PopupTouchHandleDrawableDelegate mTouchHandleDelegate; | 297 private PopupTouchHandleDrawableDelegate mTouchHandleDelegate; |
297 | 298 |
298 private PositionObserver mPositionObserver; | 299 private PositionObserver mPositionObserver; |
299 | 300 |
300 // Size of the viewport in physical pixels as set from onSizeChanged. | 301 // Size of the viewport in physical pixels as set from onSizeChanged. |
301 private int mViewportWidthPix; | 302 private int mViewportWidthPix; |
302 private int mViewportHeightPix; | 303 private int mViewportHeightPix; |
303 private int mPhysicalBackingWidthPix; | 304 private int mPhysicalBackingWidthPix; |
304 private int mPhysicalBackingHeightPix; | 305 private int mPhysicalBackingHeightPix; |
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 case SelectionEventType.SELECTION_CLEARED: | 2185 case SelectionEventType.SELECTION_CLEARED: |
2185 mHasSelection = false; | 2186 mHasSelection = false; |
2186 mUnselectAllOnActionModeDismiss = false; | 2187 mUnselectAllOnActionModeDismiss = false; |
2187 hideSelectActionBar(); | 2188 hideSelectActionBar(); |
2188 break; | 2189 break; |
2189 | 2190 |
2190 case SelectionEventType.INSERTION_SHOWN: | 2191 case SelectionEventType.INSERTION_SHOWN: |
2191 mHasInsertion = true; | 2192 mHasInsertion = true; |
2192 break; | 2193 break; |
2193 | 2194 |
2194 case SelectionEventType.INSERTION_MOVED: | 2195 case SelectionEventType.INSERTION_DRAG_STARTED: |
2195 // TODO(jdduke): Handle case where movement triggered by focus. | 2196 mWasPastePopupShowingOnInsertionDragStart = getPastePopup().isSh
owing(); |
2196 hidePastePopup(); | 2197 hidePastePopup(); |
2197 break; | 2198 break; |
2198 | 2199 |
| 2200 case SelectionEventType.INSERTION_MOVED: |
| 2201 if (getPastePopup().isShowing() && !isScrollInProgress()) { |
| 2202 showPastePopup((int) posXDip, (int) posYDip); |
| 2203 } else { |
| 2204 hidePastePopup(); |
| 2205 } |
| 2206 break; |
| 2207 |
2199 case SelectionEventType.INSERTION_TAPPED: | 2208 case SelectionEventType.INSERTION_TAPPED: |
2200 if (getPastePopup().isShowing()) | 2209 if (mWasPastePopupShowingOnInsertionDragStart) |
2201 mPastePopupMenu.hide(); | 2210 mPastePopupMenu.hide(); |
2202 else | 2211 else |
2203 showPastePopup((int) posXDip, (int) posYDip); | 2212 showPastePopup((int) posXDip, (int) posYDip); |
2204 break; | 2213 break; |
2205 | 2214 |
2206 case SelectionEventType.INSERTION_CLEARED: | 2215 case SelectionEventType.INSERTION_CLEARED: |
2207 mHasInsertion = false; | 2216 mHasInsertion = false; |
| 2217 mWasPastePopupShowingOnInsertionDragStart = false; |
2208 hidePastePopup(); | 2218 hidePastePopup(); |
2209 break; | 2219 break; |
2210 | 2220 |
2211 default: | 2221 default: |
2212 assert false : "Invalid selection event type."; | 2222 assert false : "Invalid selection event type."; |
2213 } | 2223 } |
2214 } | 2224 } |
2215 | 2225 |
2216 public boolean getUseDesktopUserAgent() { | 2226 public boolean getUseDesktopUserAgent() { |
2217 if (mNativeContentViewCore != 0) { | 2227 if (mNativeContentViewCore != 0) { |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 | 3309 |
3300 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3310 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3301 int x, int y, int w, int h); | 3311 int x, int y, int w, int h); |
3302 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); | 3312 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); |
3303 | 3313 |
3304 private native void nativeResumeResponseDeferredAtStart( | 3314 private native void nativeResumeResponseDeferredAtStart( |
3305 long nativeContentViewCoreImpl); | 3315 long nativeContentViewCoreImpl); |
3306 private native void nativeSetHasPendingNavigationTransitionForTesting( | 3316 private native void nativeSetHasPendingNavigationTransitionForTesting( |
3307 long nativeContentViewCoreImpl); | 3317 long nativeContentViewCoreImpl); |
3308 } | 3318 } |
OLD | NEW |