Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 470193005: Hide PopupZoomer when the container view or window loses focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deleted an empty line Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/PopupZoomerTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 public ContentSettings getContentSettings() { 1438 public ContentSettings getContentSettings() {
1436 return mContentSettings; 1439 return mContentSettings;
1437 } 1440 }
1438 1441
1439 private void hidePopups() { 1442 private void hidePopups() {
1440 mUnselectAllOnActionModeDismiss = true; 1443 mUnselectAllOnActionModeDismiss = true;
1441 hideSelectActionBar(); 1444 hideSelectActionBar();
1442 hidePastePopup(); 1445 hidePastePopup();
1443 hideSelectPopup(); 1446 hideSelectPopup();
1444 hideTextHandles(); 1447 hideTextHandles();
1448 mPopupZoomer.hide(false);
1445 } 1449 }
1446 1450
1447 public void hideSelectActionBar() { 1451 public void hideSelectActionBar() {
1448 if (mActionMode != null) { 1452 if (mActionMode != null) {
1449 mActionMode.finish(); 1453 mActionMode.finish();
1450 mActionMode = null; 1454 mActionMode = null;
1451 } 1455 }
1452 } 1456 }
1453 1457
1454 public boolean isSelectActionBarShowing() { 1458 public boolean isSelectActionBarShowing() {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 */ 1633 */
1630 public void selectWordAroundCaret() { 1634 public void selectWordAroundCaret() {
1631 assert mWebContents != null; 1635 assert mWebContents != null;
1632 mWebContents.selectWordAroundCaret(); 1636 mWebContents.selectWordAroundCaret();
1633 } 1637 }
1634 1638
1635 /** 1639 /**
1636 * @see View#onWindowFocusChanged(boolean) 1640 * @see View#onWindowFocusChanged(boolean)
1637 */ 1641 */
1638 public void onWindowFocusChanged(boolean hasWindowFocus) { 1642 public void onWindowFocusChanged(boolean hasWindowFocus) {
1639 if (!hasWindowFocus) resetGestureDetection(); 1643 if (!hasWindowFocus) {
1644 resetGestureDetection();
1645 mPopupZoomer.hide(false);
jdduke (slow) 2014/08/21 14:46:41 When is this method called (without onHide also be
raghu 2014/08/21 16:12:32 Acknowledged. Its not necessary after hiding the z
1646 }
1640 } 1647 }
1641 1648
1642 public void onFocusChanged(boolean gainFocus) { 1649 public void onFocusChanged(boolean gainFocus) {
1643 if (!gainFocus) { 1650 if (!gainFocus) {
1644 hideImeIfNeeded(); 1651 hideImeIfNeeded();
1645 cancelRequestToScrollFocusedEditableNodeIntoView(); 1652 cancelRequestToScrollFocusedEditableNodeIntoView();
1646 hidePastePopup(); 1653 hidePastePopup();
1647 hideTextHandles(); 1654 hideTextHandles();
1655 mPopupZoomer.hide(false);
jdduke (slow) 2014/08/21 14:46:41 Just curious, is this a source of bugs? Is there h
raghu 2014/08/21 16:12:32 I didnt see any harm in keeping it visible, but I
1648 } 1656 }
1649 if (mNativeContentViewCore != 0) nativeSetFocus(mNativeContentViewCore, gainFocus); 1657 if (mNativeContentViewCore != 0) nativeSetFocus(mNativeContentViewCore, gainFocus);
1650 } 1658 }
1651 1659
1652 /** 1660 /**
1653 * @see View#onKeyUp(int, KeyEvent) 1661 * @see View#onKeyUp(int, KeyEvent)
1654 */ 1662 */
1655 public boolean onKeyUp(int keyCode, KeyEvent event) { 1663 public boolean onKeyUp(int keyCode, KeyEvent event) {
1656 if (mPopupZoomer.isShowing() && keyCode == KeyEvent.KEYCODE_BACK) { 1664 if (keyCode == KeyEvent.KEYCODE_BACK) {
jdduke (slow) 2014/08/21 14:46:41 Actually, this isn't quite right, as now we'll nev
raghu 2014/08/21 16:12:32 Done. It was a mistake to overlook the return stat
1657 mPopupZoomer.hide(true); 1665 mPopupZoomer.hide(true);
1658 return true; 1666 return true;
1659 } 1667 }
1660 return mContainerViewInternals.super_onKeyUp(keyCode, event); 1668 return mContainerViewInternals.super_onKeyUp(keyCode, event);
1661 } 1669 }
1662 1670
1663 /** 1671 /**
1664 * @see View#dispatchKeyEventPreIme(KeyEvent) 1672 * @see View#dispatchKeyEventPreIme(KeyEvent)
1665 */ 1673 */
1666 public boolean dispatchKeyEventPreIme(KeyEvent event) { 1674 public boolean dispatchKeyEventPreIme(KeyEvent event) {
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 private native void nativeWasResized(long nativeContentViewCoreImpl); 3215 private native void nativeWasResized(long nativeContentViewCoreImpl);
3208 3216
3209 private native void nativeSetAccessibilityEnabled( 3217 private native void nativeSetAccessibilityEnabled(
3210 long nativeContentViewCoreImpl, boolean enabled); 3218 long nativeContentViewCoreImpl, boolean enabled);
3211 3219
3212 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3220 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3213 int x, int y, int w, int h); 3221 int x, int y, int w, int h);
3214 3222
3215 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3223 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3216 } 3224 }
OLDNEW
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/PopupZoomerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698