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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 3ee52e862976573aaa5484ef6d37bc001c0dde56..9dea1cf20d90e39fef4c10dde07a10e3e14892b0 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -574,6 +574,11 @@ public class ContentViewCore
}
@VisibleForTesting
+ public void setImeAdapterForTest(ImeAdapter imeAdapter) {
+ mImeAdapter = imeAdapter;
+ }
+
+ @VisibleForTesting
public ImeAdapter getImeAdapterForTest() {
return mImeAdapter;
}
@@ -1825,6 +1830,17 @@ public class ContentViewCore
return mContainerViewInternals.super_dispatchKeyEvent(event);
}
+ if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) {
+ showImeIfNeeded();
+ // Event is not consumed here, because ImeAdapter might interpret
+ // it as "Enter".
+ // showImeIfNeeded respects the policy of
+ // InputMethodService.onEvaluateInputViewShown. So IME will not be
+ // shown if you have QWERTY physical keyboard attached.
+ // Also, IME will not be shown if the focus is not on the input
+ // field. See ImeAdapter.attachAndShowIfNeeded
+ }
+
if (mImeAdapter.dispatchKeyEvent(event)) return true;
return mContainerViewInternals.super_dispatchKeyEvent(event);
« 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