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.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.ContentResolver; | 10 import android.content.ContentResolver; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 import org.chromium.base.CommandLine; | 52 import org.chromium.base.CommandLine; |
53 import org.chromium.base.JNINamespace; | 53 import org.chromium.base.JNINamespace; |
54 import org.chromium.base.ObserverList; | 54 import org.chromium.base.ObserverList; |
55 import org.chromium.base.ObserverList.RewindableIterator; | 55 import org.chromium.base.ObserverList.RewindableIterator; |
56 import org.chromium.base.TraceEvent; | 56 import org.chromium.base.TraceEvent; |
57 import org.chromium.content.R; | 57 import org.chromium.content.R; |
58 import org.chromium.content.browser.ScreenOrientationListener.ScreenOrientationO
bserver; | 58 import org.chromium.content.browser.ScreenOrientationListener.ScreenOrientationO
bserver; |
59 import org.chromium.content.browser.accessibility.AccessibilityInjector; | 59 import org.chromium.content.browser.accessibility.AccessibilityInjector; |
60 import org.chromium.content.browser.accessibility.BrowserAccessibilityManager; | 60 import org.chromium.content.browser.accessibility.BrowserAccessibilityManager; |
61 import org.chromium.content.browser.input.AdapterInputConnection; | 61 import org.chromium.content.browser.input.AdapterInputConnection; |
| 62 import org.chromium.content.browser.input.GamepadAdapter; |
62 import org.chromium.content.browser.input.HandleView; | 63 import org.chromium.content.browser.input.HandleView; |
63 import org.chromium.content.browser.input.ImeAdapter; | 64 import org.chromium.content.browser.input.ImeAdapter; |
64 import org.chromium.content.browser.input.ImeAdapter.AdapterInputConnectionFacto
ry; | 65 import org.chromium.content.browser.input.ImeAdapter.AdapterInputConnectionFacto
ry; |
65 import org.chromium.content.browser.input.InputMethodManagerWrapper; | 66 import org.chromium.content.browser.input.InputMethodManagerWrapper; |
66 import org.chromium.content.browser.input.InsertionHandleController; | 67 import org.chromium.content.browser.input.InsertionHandleController; |
67 import org.chromium.content.browser.input.SelectPopupDialog; | 68 import org.chromium.content.browser.input.SelectPopupDialog; |
68 import org.chromium.content.browser.input.SelectPopupItem; | 69 import org.chromium.content.browser.input.SelectPopupItem; |
69 import org.chromium.content.browser.input.SelectionHandleController; | 70 import org.chromium.content.browser.input.SelectionHandleController; |
70 import org.chromium.content.common.ContentSwitches; | 71 import org.chromium.content.common.ContentSwitches; |
71 import org.chromium.content_public.browser.GestureStateListener; | 72 import org.chromium.content_public.browser.GestureStateListener; |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 } | 1449 } |
1449 | 1450 |
1450 /** | 1451 /** |
1451 * @see View#onAttachedToWindow() | 1452 * @see View#onAttachedToWindow() |
1452 */ | 1453 */ |
1453 @SuppressWarnings("javadoc") | 1454 @SuppressWarnings("javadoc") |
1454 public void onAttachedToWindow() { | 1455 public void onAttachedToWindow() { |
1455 setAccessibilityState(mAccessibilityManager.isEnabled()); | 1456 setAccessibilityState(mAccessibilityManager.isEnabled()); |
1456 | 1457 |
1457 ScreenOrientationListener.getInstance().addObserver(this, mContext); | 1458 ScreenOrientationListener.getInstance().addObserver(this, mContext); |
| 1459 GamepadAdapter.onAttachedToWindow(mContext); |
1458 } | 1460 } |
1459 | 1461 |
1460 /** | 1462 /** |
1461 * @see View#onDetachedFromWindow() | 1463 * @see View#onDetachedFromWindow() |
1462 */ | 1464 */ |
1463 @SuppressWarnings("javadoc") | 1465 @SuppressWarnings("javadoc") |
1464 @SuppressLint("MissingSuperCall") | 1466 @SuppressLint("MissingSuperCall") |
1465 public void onDetachedFromWindow() { | 1467 public void onDetachedFromWindow() { |
1466 setInjectedAccessibility(false); | 1468 setInjectedAccessibility(false); |
1467 hidePopupDialog(); | 1469 hidePopupDialog(); |
1468 mZoomControlsDelegate.dismissZoomPicker(); | 1470 mZoomControlsDelegate.dismissZoomPicker(); |
1469 unregisterAccessibilityContentObserver(); | 1471 unregisterAccessibilityContentObserver(); |
1470 | 1472 |
1471 ScreenOrientationListener.getInstance().removeObserver(this); | 1473 ScreenOrientationListener.getInstance().removeObserver(this); |
| 1474 GamepadAdapter.onDetachedFromWindow(); |
1472 } | 1475 } |
1473 | 1476 |
1474 /** | 1477 /** |
1475 * @see View#onVisibilityChanged(android.view.View, int) | 1478 * @see View#onVisibilityChanged(android.view.View, int) |
1476 */ | 1479 */ |
1477 public void onVisibilityChanged(View changedView, int visibility) { | 1480 public void onVisibilityChanged(View changedView, int visibility) { |
1478 if (visibility != View.VISIBLE) { | 1481 if (visibility != View.VISIBLE) { |
1479 mZoomControlsDelegate.dismissZoomPicker(); | 1482 mZoomControlsDelegate.dismissZoomPicker(); |
1480 } | 1483 } |
1481 } | 1484 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 } | 1696 } |
1694 | 1697 |
1695 /** | 1698 /** |
1696 * @see View#dispatchKeyEvent(KeyEvent) | 1699 * @see View#dispatchKeyEvent(KeyEvent) |
1697 */ | 1700 */ |
1698 public boolean dispatchKeyEvent(KeyEvent event) { | 1701 public boolean dispatchKeyEvent(KeyEvent event) { |
1699 if (getContentViewClient().shouldOverrideKeyEvent(event)) { | 1702 if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
1700 return mContainerViewInternals.super_dispatchKeyEvent(event); | 1703 return mContainerViewInternals.super_dispatchKeyEvent(event); |
1701 } | 1704 } |
1702 | 1705 |
| 1706 if (GamepadAdapter.onKeyEvent(event)) return true; |
| 1707 |
1703 if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) { | 1708 if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) { |
1704 showImeIfNeeded(); | 1709 showImeIfNeeded(); |
1705 // Event is not consumed here, because ImeAdapter might interpret | 1710 // Event is not consumed here, because ImeAdapter might interpret |
1706 // it as "Enter". | 1711 // it as "Enter". |
1707 // showImeIfNeeded respects the policy of | 1712 // showImeIfNeeded respects the policy of |
1708 // InputMethodService.onEvaluateInputViewShown. So IME will not be | 1713 // InputMethodService.onEvaluateInputViewShown. So IME will not be |
1709 // shown if you have QWERTY physical keyboard attached. | 1714 // shown if you have QWERTY physical keyboard attached. |
1710 // Also, IME will not be shown if the focus is not on the input | 1715 // Also, IME will not be shown if the focus is not on the input |
1711 // field. See ImeAdapter.attachAndShowIfNeeded | 1716 // field. See ImeAdapter.attachAndShowIfNeeded |
1712 } | 1717 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 mFakeMouseMoveRunnable = new Runnable() { | 1766 mFakeMouseMoveRunnable = new Runnable() { |
1762 @Override | 1767 @Override |
1763 public void run() { | 1768 public void run() { |
1764 onHoverEvent(eventFakeMouseMove); | 1769 onHoverEvent(eventFakeMouseMove); |
1765 } | 1770 } |
1766 }; | 1771 }; |
1767 mContainerView.postDelayed(mFakeMouseMoveRunnable, 250); | 1772 mContainerView.postDelayed(mFakeMouseMoveRunnable, 250); |
1768 return true; | 1773 return true; |
1769 } | 1774 } |
1770 } | 1775 } |
| 1776 |
| 1777 if (GamepadAdapter.onMotionEvent(event)) return true; |
| 1778 |
1771 return mContainerViewInternals.super_onGenericMotionEvent(event); | 1779 return mContainerViewInternals.super_onGenericMotionEvent(event); |
1772 } | 1780 } |
1773 | 1781 |
1774 /** | 1782 /** |
1775 * @see View#scrollBy(int, int) | 1783 * @see View#scrollBy(int, int) |
1776 * Currently the ContentView scrolling happens in the native side. In | 1784 * Currently the ContentView scrolling happens in the native side. In |
1777 * the Java view system, it is always pinned at (0, 0). scrollBy() and scrol
lTo() | 1785 * the Java view system, it is always pinned at (0, 0). scrollBy() and scrol
lTo() |
1778 * are overridden, so that View's mScrollX and mScrollY will be unchanged at | 1786 * are overridden, so that View's mScrollX and mScrollY will be unchanged at |
1779 * (0, 0). This is critical for drawing ContentView correctly. | 1787 * (0, 0). This is critical for drawing ContentView correctly. |
1780 */ | 1788 */ |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 boolean enableHiding, boolean enableShowing, boolean animate); | 3304 boolean enableHiding, boolean enableShowing, boolean animate); |
3297 | 3305 |
3298 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); | 3306 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); |
3299 | 3307 |
3300 private native void nativeSetAccessibilityEnabled( | 3308 private native void nativeSetAccessibilityEnabled( |
3301 long nativeContentViewCoreImpl, boolean enabled); | 3309 long nativeContentViewCoreImpl, boolean enabled); |
3302 | 3310 |
3303 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3311 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3304 int x, int y, int w, int h); | 3312 int x, int y, int w, int h); |
3305 } | 3313 } |
OLD | NEW |