| 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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 /** | 1450 /** |
| 1451 * @see View#onAttachedToWindow() | 1451 * @see View#onAttachedToWindow() |
| 1452 */ | 1452 */ |
| 1453 @SuppressWarnings("javadoc") | 1453 @SuppressWarnings("javadoc") |
| 1454 public void onAttachedToWindow() { | 1454 public void onAttachedToWindow() { |
| 1455 setAccessibilityState(mAccessibilityManager.isEnabled()); | 1455 setAccessibilityState(mAccessibilityManager.isEnabled()); |
| 1456 | 1456 |
| 1457 ScreenOrientationListener.getInstance().addObserver(this, mContext); | 1457 ScreenOrientationListener.getInstance().addObserver(this, mContext); |
| 1458 GamepadList.onAttachedToWindow(mContext); |
| 1458 } | 1459 } |
| 1459 | 1460 |
| 1460 /** | 1461 /** |
| 1461 * @see View#onDetachedFromWindow() | 1462 * @see View#onDetachedFromWindow() |
| 1462 */ | 1463 */ |
| 1463 @SuppressWarnings("javadoc") | 1464 @SuppressWarnings("javadoc") |
| 1464 @SuppressLint("MissingSuperCall") | 1465 @SuppressLint("MissingSuperCall") |
| 1465 public void onDetachedFromWindow() { | 1466 public void onDetachedFromWindow() { |
| 1466 setInjectedAccessibility(false); | 1467 setInjectedAccessibility(false); |
| 1467 hidePopupDialog(); | 1468 hidePopupDialog(); |
| 1468 mZoomControlsDelegate.dismissZoomPicker(); | 1469 mZoomControlsDelegate.dismissZoomPicker(); |
| 1469 unregisterAccessibilityContentObserver(); | 1470 unregisterAccessibilityContentObserver(); |
| 1470 | 1471 |
| 1471 ScreenOrientationListener.getInstance().removeObserver(this); | 1472 ScreenOrientationListener.getInstance().removeObserver(this); |
| 1473 GamepadList.onDetachedFromWindow(); |
| 1472 } | 1474 } |
| 1473 | 1475 |
| 1474 /** | 1476 /** |
| 1475 * @see View#onVisibilityChanged(android.view.View, int) | 1477 * @see View#onVisibilityChanged(android.view.View, int) |
| 1476 */ | 1478 */ |
| 1477 public void onVisibilityChanged(View changedView, int visibility) { | 1479 public void onVisibilityChanged(View changedView, int visibility) { |
| 1478 if (visibility != View.VISIBLE) { | 1480 if (visibility != View.VISIBLE) { |
| 1479 mZoomControlsDelegate.dismissZoomPicker(); | 1481 mZoomControlsDelegate.dismissZoomPicker(); |
| 1480 } | 1482 } |
| 1481 } | 1483 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); | 1691 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); |
| 1690 } finally { | 1692 } finally { |
| 1691 TraceEvent.end(); | 1693 TraceEvent.end(); |
| 1692 } | 1694 } |
| 1693 } | 1695 } |
| 1694 | 1696 |
| 1695 /** | 1697 /** |
| 1696 * @see View#dispatchKeyEvent(KeyEvent) | 1698 * @see View#dispatchKeyEvent(KeyEvent) |
| 1697 */ | 1699 */ |
| 1698 public boolean dispatchKeyEvent(KeyEvent event) { | 1700 public boolean dispatchKeyEvent(KeyEvent event) { |
| 1701 if (GamepadList.dispatchKeyEvent(event)) { |
| 1702 return true; |
| 1703 } |
| 1699 if (getContentViewClient().shouldOverrideKeyEvent(event)) { | 1704 if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
| 1700 return mContainerViewInternals.super_dispatchKeyEvent(event); | 1705 return mContainerViewInternals.super_dispatchKeyEvent(event); |
| 1701 } | 1706 } |
| 1702 | 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 event.getX(), event.getY()); | 1745 event.getX(), event.getY()); |
| 1741 } | 1746 } |
| 1742 TraceEvent.end("onHoverEvent"); | 1747 TraceEvent.end("onHoverEvent"); |
| 1743 return true; | 1748 return true; |
| 1744 } | 1749 } |
| 1745 | 1750 |
| 1746 /** | 1751 /** |
| 1747 * @see View#onGenericMotionEvent(MotionEvent) | 1752 * @see View#onGenericMotionEvent(MotionEvent) |
| 1748 */ | 1753 */ |
| 1749 public boolean onGenericMotionEvent(MotionEvent event) { | 1754 public boolean onGenericMotionEvent(MotionEvent event) { |
| 1755 if (GamepadList.onGenericMotionEvent(event)) { |
| 1756 return true; |
| 1757 } |
| 1750 if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { | 1758 if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { |
| 1751 switch (event.getAction()) { | 1759 switch (event.getAction()) { |
| 1752 case MotionEvent.ACTION_SCROLL: | 1760 case MotionEvent.ACTION_SCROLL: |
| 1753 nativeSendMouseWheelEvent(mNativeContentViewCore, event.getE
ventTime(), | 1761 nativeSendMouseWheelEvent(mNativeContentViewCore, event.getE
ventTime(), |
| 1754 event.getX(), event.getY(), | 1762 event.getX(), event.getY(), |
| 1755 event.getAxisValue(MotionEvent.AXIS_VSCROLL)); | 1763 event.getAxisValue(MotionEvent.AXIS_VSCROLL)); |
| 1756 | 1764 |
| 1757 mContainerView.removeCallbacks(mFakeMouseMoveRunnable); | 1765 mContainerView.removeCallbacks(mFakeMouseMoveRunnable); |
| 1758 // Send a delayed onMouseMove event so that we end | 1766 // Send a delayed onMouseMove event so that we end |
| 1759 // up hovering over the right position after the scroll. | 1767 // 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); | 3303 boolean enableHiding, boolean enableShowing, boolean animate); |
| 3296 | 3304 |
| 3297 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); | 3305 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); |
| 3298 | 3306 |
| 3299 private native void nativeSetAccessibilityEnabled( | 3307 private native void nativeSetAccessibilityEnabled( |
| 3300 long nativeContentViewCoreImpl, boolean enabled); | 3308 long nativeContentViewCoreImpl, boolean enabled); |
| 3301 | 3309 |
| 3302 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3310 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
| 3303 int x, int y, int w, int h); | 3311 int x, int y, int w, int h); |
| 3304 } | 3312 } |
| OLD | NEW |