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.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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |