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

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: Inserted line break 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 if (mPopupZoomer.isShowing()) {
jdduke (slow) 2014/08/20 15:47:46 Can you also just make this |mPopupZoomer.hide(tru
raghu 2014/08/21 06:23:59 Done. I have done it in |onKeyUp| also. Also, I f
525 mPopupZoomer.hide(true); 525 mPopupZoomer.hide(true);
526 } 526 }
527 getContentViewClient().onImeEvent(); 527 getContentViewClient().onImeEvent();
528 hideTextHandles(); 528 hideTextHandles();
529 } 529 }
530 530
531 @Override 531 @Override
532 public void onDismissInput() { 532 public void onDismissInput() {
533 getContentViewClient().onImeStateChangeRequested(false); 533 getContentViewClient().onImeStateChangeRequested(false);
534 } 534 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 public boolean onLongPress(View v, MotionEvent e) { 747 public boolean onLongPress(View v, MotionEvent e) {
748 if (mNativeContentViewCore != 0) { 748 if (mNativeContentViewCore != 0) {
749 nativeLongPress(mNativeContentViewCore, e.getEventTime(), e. getX(), e.getY()); 749 nativeLongPress(mNativeContentViewCore, e.getEventTime(), e. getX(), e.getY());
750 } 750 }
751 return true; 751 return true;
752 } 752 }
753 }; 753 };
754 mPopupZoomer.setOnTapListener(listener); 754 mPopupZoomer.setOnTapListener(listener);
755 } 755 }
756 756
757 @VisibleForTesting
758 public void setPopupZoomerForTest(PopupZoomer popupZoomer) {
759 mPopupZoomer = popupZoomer;
760 }
761
757 /** 762 /**
758 * Destroy the internal state of the ContentView. This method may only be 763 * 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 764 * 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 765 * other methods may be called on this ContentView after this method has
761 * been called. 766 * been called.
762 */ 767 */
763 public void destroy() { 768 public void destroy() {
764 if (mNativeContentViewCore != 0) { 769 if (mNativeContentViewCore != 0) {
765 nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore); 770 nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore);
766 } 771 }
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 public ContentSettings getContentSettings() { 1440 public ContentSettings getContentSettings() {
1436 return mContentSettings; 1441 return mContentSettings;
1437 } 1442 }
1438 1443
1439 private void hidePopups() { 1444 private void hidePopups() {
1440 mUnselectAllOnActionModeDismiss = true; 1445 mUnselectAllOnActionModeDismiss = true;
1441 hideSelectActionBar(); 1446 hideSelectActionBar();
1442 hidePastePopup(); 1447 hidePastePopup();
1443 hideSelectPopup(); 1448 hideSelectPopup();
1444 hideTextHandles(); 1449 hideTextHandles();
1450 mPopupZoomer.hide(false);
1445 } 1451 }
1446 1452
1447 public void hideSelectActionBar() { 1453 public void hideSelectActionBar() {
1448 if (mActionMode != null) { 1454 if (mActionMode != null) {
1449 mActionMode.finish(); 1455 mActionMode.finish();
1450 mActionMode = null; 1456 mActionMode = null;
1451 } 1457 }
1452 } 1458 }
1453 1459
1454 public boolean isSelectActionBarShowing() { 1460 public boolean isSelectActionBarShowing() {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 * @see View#onWindowFocusChanged(boolean) 1642 * @see View#onWindowFocusChanged(boolean)
1637 */ 1643 */
1638 public void onWindowFocusChanged(boolean hasWindowFocus) { 1644 public void onWindowFocusChanged(boolean hasWindowFocus) {
1639 if (!hasWindowFocus) resetGestureDetection(); 1645 if (!hasWindowFocus) resetGestureDetection();
1640 } 1646 }
1641 1647
1642 public void onFocusChanged(boolean gainFocus) { 1648 public void onFocusChanged(boolean gainFocus) {
1643 if (!gainFocus) { 1649 if (!gainFocus) {
1644 hideImeIfNeeded(); 1650 hideImeIfNeeded();
1645 cancelRequestToScrollFocusedEditableNodeIntoView(); 1651 cancelRequestToScrollFocusedEditableNodeIntoView();
1646 hidePastePopup(); 1652 hidePopups();
jdduke (slow) 2014/08/20 15:47:46 Will a select popup and/or action bar action cause
raghu 2014/08/21 06:23:59 No, they are not causing the focus to change. But
1647 hideTextHandles();
1648 } 1653 }
1649 if (mNativeContentViewCore != 0) nativeSetFocus(mNativeContentViewCore, gainFocus); 1654 if (mNativeContentViewCore != 0) nativeSetFocus(mNativeContentViewCore, gainFocus);
1650 } 1655 }
1651 1656
1652 /** 1657 /**
1653 * @see View#onKeyUp(int, KeyEvent) 1658 * @see View#onKeyUp(int, KeyEvent)
1654 */ 1659 */
1655 public boolean onKeyUp(int keyCode, KeyEvent event) { 1660 public boolean onKeyUp(int keyCode, KeyEvent event) {
1656 if (mPopupZoomer.isShowing() && keyCode == KeyEvent.KEYCODE_BACK) { 1661 if (mPopupZoomer.isShowing() && keyCode == KeyEvent.KEYCODE_BACK) {
1657 mPopupZoomer.hide(true); 1662 mPopupZoomer.hide(true);
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 private native void nativeWasResized(long nativeContentViewCoreImpl); 3212 private native void nativeWasResized(long nativeContentViewCoreImpl);
3208 3213
3209 private native void nativeSetAccessibilityEnabled( 3214 private native void nativeSetAccessibilityEnabled(
3210 long nativeContentViewCoreImpl, boolean enabled); 3215 long nativeContentViewCoreImpl, boolean enabled);
3211 3216
3212 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3217 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3213 int x, int y, int w, int h); 3218 int x, int y, int w, int h);
3214 3219
3215 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3220 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3216 } 3221 }
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