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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 private final Map<String, Object> mJavaScriptInterfaces = new HashMap<String
, Object>(); | 122 private final Map<String, Object> mJavaScriptInterfaces = new HashMap<String
, Object>(); |
123 | 123 |
124 // Additionally, we keep track of all Java bound JS objects that are in use
on the | 124 // Additionally, we keep track of all Java bound JS objects that are in use
on the |
125 // current page to ensure that they are not garbage collected until the page
is | 125 // current page to ensure that they are not garbage collected until the page
is |
126 // navigated. This includes interface objects that have been removed | 126 // navigated. This includes interface objects that have been removed |
127 // via the removeJavaScriptInterface API and transient objects returned from
methods | 127 // via the removeJavaScriptInterface API and transient objects returned from
methods |
128 // on the interface object. Note we use HashSet rather than Set as the nativ
e side | 128 // on the interface object. Note we use HashSet rather than Set as the nativ
e side |
129 // expects HashSet (no bindings for interfaces). | 129 // expects HashSet (no bindings for interfaces). |
130 private final HashSet<Object> mRetainedJavaScriptObjects = new HashSet<Objec
t>(); | 130 private final HashSet<Object> mRetainedJavaScriptObjects = new HashSet<Objec
t>(); |
131 | 131 |
| 132 private GamepadList mGamepadList; |
| 133 |
132 /** | 134 /** |
133 * Interface that consumers of {@link ContentViewCore} must implement to all
ow the proper | 135 * Interface that consumers of {@link ContentViewCore} must implement to all
ow the proper |
134 * dispatching of view methods through the containing view. | 136 * dispatching of view methods through the containing view. |
135 * | 137 * |
136 * <p> | 138 * <p> |
137 * All methods with the "super_" prefix should be routed to the parent of th
e | 139 * All methods with the "super_" prefix should be routed to the parent of th
e |
138 * implementing container view. | 140 * implementing container view. |
139 */ | 141 */ |
140 @SuppressWarnings("javadoc") | 142 @SuppressWarnings("javadoc") |
141 public interface InternalAccessDelegate { | 143 public interface InternalAccessDelegate { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 mRenderCoordinates = new RenderCoordinates(); | 476 mRenderCoordinates = new RenderCoordinates(); |
475 mRenderCoordinates.setDeviceScaleFactor( | 477 mRenderCoordinates.setDeviceScaleFactor( |
476 getContext().getResources().getDisplayMetrics().density); | 478 getContext().getResources().getDisplayMetrics().density); |
477 mStartHandlePoint = mRenderCoordinates.createNormalizedPoint(); | 479 mStartHandlePoint = mRenderCoordinates.createNormalizedPoint(); |
478 mEndHandlePoint = mRenderCoordinates.createNormalizedPoint(); | 480 mEndHandlePoint = mRenderCoordinates.createNormalizedPoint(); |
479 mInsertionHandlePoint = mRenderCoordinates.createNormalizedPoint(); | 481 mInsertionHandlePoint = mRenderCoordinates.createNormalizedPoint(); |
480 mAccessibilityManager = (AccessibilityManager) | 482 mAccessibilityManager = (AccessibilityManager) |
481 getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); | 483 getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); |
482 mGestureStateListeners = new ObserverList<GestureStateListener>(); | 484 mGestureStateListeners = new ObserverList<GestureStateListener>(); |
483 mGestureStateListenersIterator = mGestureStateListeners.rewindableIterat
or(); | 485 mGestureStateListenersIterator = mGestureStateListeners.rewindableIterat
or(); |
| 486 mGamepadList = GamepadList.createInstance(context); |
484 } | 487 } |
485 | 488 |
486 /** | 489 /** |
487 * @return The context used for creating this ContentViewCore. | 490 * @return The context used for creating this ContentViewCore. |
488 */ | 491 */ |
489 @CalledByNative | 492 @CalledByNative |
490 public Context getContext() { | 493 public Context getContext() { |
491 return mContext; | 494 return mContext; |
492 } | 495 } |
493 | 496 |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); | 1825 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); |
1823 } finally { | 1826 } finally { |
1824 TraceEvent.end(); | 1827 TraceEvent.end(); |
1825 } | 1828 } |
1826 } | 1829 } |
1827 | 1830 |
1828 /** | 1831 /** |
1829 * @see View#dispatchKeyEvent(KeyEvent) | 1832 * @see View#dispatchKeyEvent(KeyEvent) |
1830 */ | 1833 */ |
1831 public boolean dispatchKeyEvent(KeyEvent event) { | 1834 public boolean dispatchKeyEvent(KeyEvent event) { |
| 1835 if (mGamepadList.isGamepadAccessed() && mGamepadList.isGamepadEvent(even
t)) { |
| 1836 return mGamepadList.updateForEvent(event); |
| 1837 } |
1832 if (getContentViewClient().shouldOverrideKeyEvent(event)) { | 1838 if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
1833 return mContainerViewInternals.super_dispatchKeyEvent(event); | 1839 return mContainerViewInternals.super_dispatchKeyEvent(event); |
1834 } | 1840 } |
1835 | 1841 |
1836 if (mImeAdapter.dispatchKeyEvent(event)) return true; | 1842 if (mImeAdapter.dispatchKeyEvent(event)) return true; |
1837 | 1843 |
1838 return mContainerViewInternals.super_dispatchKeyEvent(event); | 1844 return mContainerViewInternals.super_dispatchKeyEvent(event); |
1839 } | 1845 } |
1840 | 1846 |
1841 /** | 1847 /** |
(...skipping 13 matching lines...) Expand all Loading... |
1855 event.getX(), event.getY()); | 1861 event.getX(), event.getY()); |
1856 } | 1862 } |
1857 TraceEvent.end("onHoverEvent"); | 1863 TraceEvent.end("onHoverEvent"); |
1858 return true; | 1864 return true; |
1859 } | 1865 } |
1860 | 1866 |
1861 /** | 1867 /** |
1862 * @see View#onGenericMotionEvent(MotionEvent) | 1868 * @see View#onGenericMotionEvent(MotionEvent) |
1863 */ | 1869 */ |
1864 public boolean onGenericMotionEvent(MotionEvent event) { | 1870 public boolean onGenericMotionEvent(MotionEvent event) { |
| 1871 if (mGamepadList.isGamepadAccessed() && mGamepadList.isGamepadEvent(even
t)) { |
| 1872 return mGamepadList.updateForEvent(event); |
| 1873 } |
1865 if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { | 1874 if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { |
1866 switch (event.getAction()) { | 1875 switch (event.getAction()) { |
1867 case MotionEvent.ACTION_SCROLL: | 1876 case MotionEvent.ACTION_SCROLL: |
1868 nativeSendMouseWheelEvent(mNativeContentViewCore, event.getE
ventTime(), | 1877 nativeSendMouseWheelEvent(mNativeContentViewCore, event.getE
ventTime(), |
1869 event.getX(), event.getY(), | 1878 event.getX(), event.getY(), |
1870 event.getAxisValue(MotionEvent.AXIS_VSCROLL)); | 1879 event.getAxisValue(MotionEvent.AXIS_VSCROLL)); |
1871 | 1880 |
1872 mContainerView.removeCallbacks(mFakeMouseMoveRunnable); | 1881 mContainerView.removeCallbacks(mFakeMouseMoveRunnable); |
1873 // Send a delayed onMouseMove event so that we end | 1882 // Send a delayed onMouseMove event so that we end |
1874 // up hovering over the right position after the scroll. | 1883 // up hovering over the right position after the scroll. |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 | 3497 |
3489 private native void nativeSendSingleTapUma(long nativeContentViewCoreImpl, | 3498 private native void nativeSendSingleTapUma(long nativeContentViewCoreImpl, |
3490 int type, int count); | 3499 int type, int count); |
3491 | 3500 |
3492 private native void nativeSendActionAfterDoubleTapUma(long nativeContentView
CoreImpl, | 3501 private native void nativeSendActionAfterDoubleTapUma(long nativeContentView
CoreImpl, |
3493 int type, boolean hasDelay, int count); | 3502 int type, boolean hasDelay, int count); |
3494 | 3503 |
3495 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3504 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3496 int x, int y, int w, int h); | 3505 int x, int y, int w, int h); |
3497 } | 3506 } |
OLD | NEW |