| 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.GamepadList; |
| 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 GamepadList.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 GamepadList.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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); | 1692 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); |
| 1690 } finally { | 1693 } finally { |
| 1691 TraceEvent.end(); | 1694 TraceEvent.end(); |
| 1692 } | 1695 } |
| 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) { |
| 1702 if (GamepadList.dispatchKeyEvent(event)) return true; |
| 1699 if (getContentViewClient().shouldOverrideKeyEvent(event)) { | 1703 if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
| 1700 return mContainerViewInternals.super_dispatchKeyEvent(event); | 1704 return mContainerViewInternals.super_dispatchKeyEvent(event); |
| 1701 } | 1705 } |
| 1702 | 1706 |
| 1703 if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) { | 1707 if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) { |
| 1704 showImeIfNeeded(); | 1708 showImeIfNeeded(); |
| 1705 // Event is not consumed here, because ImeAdapter might interpret | 1709 // Event is not consumed here, because ImeAdapter might interpret |
| 1706 // it as "Enter". | 1710 // it as "Enter". |
| 1707 // showImeIfNeeded respects the policy of | 1711 // showImeIfNeeded respects the policy of |
| 1708 // InputMethodService.onEvaluateInputViewShown. So IME will not be | 1712 // InputMethodService.onEvaluateInputViewShown. So IME will not be |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 event.getX(), event.getY()); | 1744 event.getX(), event.getY()); |
| 1741 } | 1745 } |
| 1742 TraceEvent.end("onHoverEvent"); | 1746 TraceEvent.end("onHoverEvent"); |
| 1743 return true; | 1747 return true; |
| 1744 } | 1748 } |
| 1745 | 1749 |
| 1746 /** | 1750 /** |
| 1747 * @see View#onGenericMotionEvent(MotionEvent) | 1751 * @see View#onGenericMotionEvent(MotionEvent) |
| 1748 */ | 1752 */ |
| 1749 public boolean onGenericMotionEvent(MotionEvent event) { | 1753 public boolean onGenericMotionEvent(MotionEvent event) { |
| 1754 if (GamepadList.onGenericMotionEvent(event)) return true; |
| 1750 if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { | 1755 if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { |
| 1751 switch (event.getAction()) { | 1756 switch (event.getAction()) { |
| 1752 case MotionEvent.ACTION_SCROLL: | 1757 case MotionEvent.ACTION_SCROLL: |
| 1753 nativeSendMouseWheelEvent(mNativeContentViewCore, event.getE
ventTime(), | 1758 nativeSendMouseWheelEvent(mNativeContentViewCore, event.getE
ventTime(), |
| 1754 event.getX(), event.getY(), | 1759 event.getX(), event.getY(), |
| 1755 event.getAxisValue(MotionEvent.AXIS_VSCROLL)); | 1760 event.getAxisValue(MotionEvent.AXIS_VSCROLL)); |
| 1756 | 1761 |
| 1757 mContainerView.removeCallbacks(mFakeMouseMoveRunnable); | 1762 mContainerView.removeCallbacks(mFakeMouseMoveRunnable); |
| 1758 // Send a delayed onMouseMove event so that we end | 1763 // Send a delayed onMouseMove event so that we end |
| 1759 // up hovering over the right position after the scroll. | 1764 // up hovering over the right position after the scroll. |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3295 boolean enableHiding, boolean enableShowing, boolean animate); | 3300 boolean enableHiding, boolean enableShowing, boolean animate); |
| 3296 | 3301 |
| 3297 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); | 3302 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); |
| 3298 | 3303 |
| 3299 private native void nativeSetAccessibilityEnabled( | 3304 private native void nativeSetAccessibilityEnabled( |
| 3300 long nativeContentViewCoreImpl, boolean enabled); | 3305 long nativeContentViewCoreImpl, boolean enabled); |
| 3301 | 3306 |
| 3302 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3307 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
| 3303 int x, int y, int w, int h); | 3308 int x, int y, int w, int h); |
| 3304 } | 3309 } |
| OLD | NEW |