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

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

Issue 161933002: Show IME when DPAD_CENTER is pressed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a test for dpad center event Created 6 years, 10 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/ContentViewCoreDpadTest.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.app.Activity; 7 import android.app.Activity;
8 import android.app.SearchManager; 8 import android.app.SearchManager;
9 import android.content.ContentResolver; 9 import android.content.ContentResolver;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 567 }
568 568
569 @Override 569 @Override
570 public void releaseAnchorView(View anchorView) { 570 public void releaseAnchorView(View anchorView) {
571 mContainerView.removeView(anchorView); 571 mContainerView.removeView(anchorView);
572 } 572 }
573 }; 573 };
574 } 574 }
575 575
576 @VisibleForTesting 576 @VisibleForTesting
577 public void setImeAdapterForTest(ImeAdapter imeAdapter) {
578 mImeAdapter = imeAdapter;
579 }
580
581 @VisibleForTesting
577 public ImeAdapter getImeAdapterForTest() { 582 public ImeAdapter getImeAdapterForTest() {
578 return mImeAdapter; 583 return mImeAdapter;
579 } 584 }
580 585
581 @VisibleForTesting 586 @VisibleForTesting
582 public void setAdapterInputConnectionFactory(AdapterInputConnectionFactory f actory) { 587 public void setAdapterInputConnectionFactory(AdapterInputConnectionFactory f actory) {
583 mAdapterInputConnectionFactory = factory; 588 mAdapterInputConnectionFactory = factory;
584 } 589 }
585 590
586 @VisibleForTesting 591 @VisibleForTesting
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 } 1823 }
1819 1824
1820 /** 1825 /**
1821 * @see View#dispatchKeyEvent(KeyEvent) 1826 * @see View#dispatchKeyEvent(KeyEvent)
1822 */ 1827 */
1823 public boolean dispatchKeyEvent(KeyEvent event) { 1828 public boolean dispatchKeyEvent(KeyEvent event) {
1824 if (getContentViewClient().shouldOverrideKeyEvent(event)) { 1829 if (getContentViewClient().shouldOverrideKeyEvent(event)) {
1825 return mContainerViewInternals.super_dispatchKeyEvent(event); 1830 return mContainerViewInternals.super_dispatchKeyEvent(event);
1826 } 1831 }
1827 1832
1833 if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) {
1834 showImeIfNeeded();
1835 // Event is not consumed here, because ImeAdapter might interpret
1836 // it as "Enter".
1837 // showImeIfNeeded respects the policy of
1838 // InputMethodService.onEvaluateInputViewShown. So IME will not be
1839 // shown if you have QWERTY physical keyboard attached.
1840 // Also, IME will not be shown if the focus is not on the input
1841 // field. See ImeAdapter.attachAndShowIfNeeded
1842 }
1843
1828 if (mImeAdapter.dispatchKeyEvent(event)) return true; 1844 if (mImeAdapter.dispatchKeyEvent(event)) return true;
1829 1845
1830 return mContainerViewInternals.super_dispatchKeyEvent(event); 1846 return mContainerViewInternals.super_dispatchKeyEvent(event);
1831 } 1847 }
1832 1848
1833 /** 1849 /**
1834 * @see View#onHoverEvent(MotionEvent) 1850 * @see View#onHoverEvent(MotionEvent)
1835 * Mouse move events are sent on hover enter, hover move and hover exit. 1851 * Mouse move events are sent on hover enter, hover move and hover exit.
1836 * They are sent on hover exit because sometimes it acts as both a hover 1852 * They are sent on hover exit because sometimes it acts as both a hover
1837 * move and hover exit. 1853 * move and hover exit.
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
3460 3476
3461 private native void nativeSendSingleTapUma(long nativeContentViewCoreImpl, 3477 private native void nativeSendSingleTapUma(long nativeContentViewCoreImpl,
3462 int type, int count); 3478 int type, int count);
3463 3479
3464 private native void nativeSendActionAfterDoubleTapUma(long nativeContentView CoreImpl, 3480 private native void nativeSendActionAfterDoubleTapUma(long nativeContentView CoreImpl,
3465 int type, boolean hasDelay, int count); 3481 int type, boolean hasDelay, int count);
3466 3482
3467 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3483 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3468 int x, int y, int w, int h); 3484 int x, int y, int w, int h);
3469 } 3485 }
OLDNEW
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreDpadTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698