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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 @VisibleForTesting | 514 @VisibleForTesting |
515 public AdapterInputConnection getInputConnectionForTest() { | 515 public AdapterInputConnection getInputConnectionForTest() { |
516 return mInputConnection; | 516 return mInputConnection; |
517 } | 517 } |
518 | 518 |
519 private ImeAdapter createImeAdapter(Context context) { | 519 private ImeAdapter createImeAdapter(Context context) { |
520 return new ImeAdapter(mInputMethodManagerWrapper, | 520 return new ImeAdapter(mInputMethodManagerWrapper, |
521 new ImeAdapter.ImeAdapterDelegate() { | 521 new ImeAdapter.ImeAdapterDelegate() { |
522 @Override | 522 @Override |
523 public void onImeEvent() { | 523 public void onImeEvent() { |
524 if (mPopupZoomer.isShowing()) { | 524 mPopupZoomer.hide(true); |
525 mPopupZoomer.hide(true); | |
526 } | |
527 getContentViewClient().onImeEvent(); | 525 getContentViewClient().onImeEvent(); |
528 hideTextHandles(); | 526 hideTextHandles(); |
529 } | 527 } |
530 | 528 |
531 @Override | 529 @Override |
532 public void onDismissInput() { | 530 public void onDismissInput() { |
533 getContentViewClient().onImeStateChangeRequested(false); | 531 getContentViewClient().onImeStateChangeRequested(false); |
534 } | 532 } |
535 | 533 |
536 @Override | 534 @Override |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 public boolean onLongPress(View v, MotionEvent e) { | 745 public boolean onLongPress(View v, MotionEvent e) { |
748 if (mNativeContentViewCore != 0) { | 746 if (mNativeContentViewCore != 0) { |
749 nativeLongPress(mNativeContentViewCore, e.getEventTime(), e.
getX(), e.getY()); | 747 nativeLongPress(mNativeContentViewCore, e.getEventTime(), e.
getX(), e.getY()); |
750 } | 748 } |
751 return true; | 749 return true; |
752 } | 750 } |
753 }; | 751 }; |
754 mPopupZoomer.setOnTapListener(listener); | 752 mPopupZoomer.setOnTapListener(listener); |
755 } | 753 } |
756 | 754 |
| 755 @VisibleForTesting |
| 756 public void setPopupZoomerForTest(PopupZoomer popupZoomer) { |
| 757 mPopupZoomer = popupZoomer; |
| 758 } |
| 759 |
757 /** | 760 /** |
758 * Destroy the internal state of the ContentView. This method may only be | 761 * Destroy the internal state of the ContentView. This method may only be |
759 * called after the ContentView has been removed from the view system. No | 762 * called after the ContentView has been removed from the view system. No |
760 * other methods may be called on this ContentView after this method has | 763 * other methods may be called on this ContentView after this method has |
761 * been called. | 764 * been called. |
762 */ | 765 */ |
763 public void destroy() { | 766 public void destroy() { |
764 if (mNativeContentViewCore != 0) { | 767 if (mNativeContentViewCore != 0) { |
765 nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore); | 768 nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore); |
766 } | 769 } |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 public ContentSettings getContentSettings() { | 1426 public ContentSettings getContentSettings() { |
1424 return mContentSettings; | 1427 return mContentSettings; |
1425 } | 1428 } |
1426 | 1429 |
1427 private void hidePopups() { | 1430 private void hidePopups() { |
1428 mUnselectAllOnActionModeDismiss = true; | 1431 mUnselectAllOnActionModeDismiss = true; |
1429 hideSelectActionBar(); | 1432 hideSelectActionBar(); |
1430 hidePastePopup(); | 1433 hidePastePopup(); |
1431 hideSelectPopup(); | 1434 hideSelectPopup(); |
1432 hideTextHandles(); | 1435 hideTextHandles(); |
| 1436 mPopupZoomer.hide(false); |
1433 } | 1437 } |
1434 | 1438 |
1435 public void hideSelectActionBar() { | 1439 public void hideSelectActionBar() { |
1436 if (mActionMode != null) { | 1440 if (mActionMode != null) { |
1437 mActionMode.finish(); | 1441 mActionMode.finish(); |
1438 mActionMode = null; | 1442 mActionMode = null; |
1439 } | 1443 } |
1440 } | 1444 } |
1441 | 1445 |
1442 public boolean isSelectActionBarShowing() { | 1446 public boolean isSelectActionBarShowing() { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 public void onWindowFocusChanged(boolean hasWindowFocus) { | 1620 public void onWindowFocusChanged(boolean hasWindowFocus) { |
1617 if (!hasWindowFocus) resetGestureDetection(); | 1621 if (!hasWindowFocus) resetGestureDetection(); |
1618 } | 1622 } |
1619 | 1623 |
1620 public void onFocusChanged(boolean gainFocus) { | 1624 public void onFocusChanged(boolean gainFocus) { |
1621 if (!gainFocus) { | 1625 if (!gainFocus) { |
1622 hideImeIfNeeded(); | 1626 hideImeIfNeeded(); |
1623 cancelRequestToScrollFocusedEditableNodeIntoView(); | 1627 cancelRequestToScrollFocusedEditableNodeIntoView(); |
1624 hidePastePopup(); | 1628 hidePastePopup(); |
1625 hideTextHandles(); | 1629 hideTextHandles(); |
| 1630 mPopupZoomer.hide(false); |
1626 } | 1631 } |
1627 if (mNativeContentViewCore != 0) nativeSetFocus(mNativeContentViewCore,
gainFocus); | 1632 if (mNativeContentViewCore != 0) nativeSetFocus(mNativeContentViewCore,
gainFocus); |
1628 } | 1633 } |
1629 | 1634 |
1630 /** | 1635 /** |
1631 * @see View#onKeyUp(int, KeyEvent) | 1636 * @see View#onKeyUp(int, KeyEvent) |
1632 */ | 1637 */ |
1633 public boolean onKeyUp(int keyCode, KeyEvent event) { | 1638 public boolean onKeyUp(int keyCode, KeyEvent event) { |
1634 if (mPopupZoomer.isShowing() && keyCode == KeyEvent.KEYCODE_BACK) { | 1639 if (mPopupZoomer.isShowing() && keyCode == KeyEvent.KEYCODE_BACK) { |
1635 mPopupZoomer.hide(true); | 1640 mPopupZoomer.hide(true); |
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 private native void nativeWasResized(long nativeContentViewCoreImpl); | 3189 private native void nativeWasResized(long nativeContentViewCoreImpl); |
3185 | 3190 |
3186 private native void nativeSetAccessibilityEnabled( | 3191 private native void nativeSetAccessibilityEnabled( |
3187 long nativeContentViewCoreImpl, boolean enabled); | 3192 long nativeContentViewCoreImpl, boolean enabled); |
3188 | 3193 |
3189 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3194 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3190 int x, int y, int w, int h); | 3195 int x, int y, int w, int h); |
3191 | 3196 |
3192 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); | 3197 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); |
3193 } | 3198 } |
OLD | NEW |