| Index: content/browser/android/content_view_core_impl.cc
|
| diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
|
| index 141e1f5981722ec7c5fea04450f105455eae84b1..d14c96e9d53696017c979d354eed8284e6ad3940 100644
|
| --- a/content/browser/android/content_view_core_impl.cc
|
| +++ b/content/browser/android/content_view_core_impl.cc
|
| @@ -76,6 +76,7 @@ using base::android::JavaRef;
|
| using base::android::ScopedJavaLocalRef;
|
| using blink::WebGestureEvent;
|
| using blink::WebInputEvent;
|
| +using ui::MotionEventAndroid;
|
|
|
| namespace content {
|
|
|
| @@ -160,6 +161,17 @@ int ToGestureEventType(WebInputEvent::Type type) {
|
| }
|
| }
|
|
|
| +void RecordToolTypeForActionDown(MotionEventAndroid& event) {
|
| + MotionEventAndroid::Action action = event.GetAction();
|
| + if (action == MotionEventAndroid::ACTION_DOWN ||
|
| + action == MotionEventAndroid::ACTION_POINTER_DOWN ||
|
| + action == MotionEventAndroid::ACTION_BUTTON_PRESS) {
|
| + UMA_HISTOGRAM_ENUMERATION("Event.AndroidActionDown.ToolType",
|
| + event.GetToolType(0),
|
| + MotionEventAndroid::TOOL_TYPE_LAST + 1);
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| // Enables a callback when the underlying WebContents is destroyed, to enable
|
| @@ -915,7 +927,7 @@ jboolean ContentViewCoreImpl::OnTouchEvent(
|
| if (!rwhv)
|
| return false;
|
|
|
| - ui::MotionEventAndroid::Pointer pointer0(pointer_id_0,
|
| + MotionEventAndroid::Pointer pointer0(pointer_id_0,
|
| pos_x_0,
|
| pos_y_0,
|
| touch_major_0,
|
| @@ -923,7 +935,7 @@ jboolean ContentViewCoreImpl::OnTouchEvent(
|
| orientation_0,
|
| tilt_0,
|
| android_tool_type_0);
|
| - ui::MotionEventAndroid::Pointer pointer1(pointer_id_1,
|
| + MotionEventAndroid::Pointer pointer1(pointer_id_1,
|
| pos_x_1,
|
| pos_y_1,
|
| touch_major_1,
|
| @@ -931,7 +943,7 @@ jboolean ContentViewCoreImpl::OnTouchEvent(
|
| orientation_1,
|
| tilt_1,
|
| android_tool_type_1);
|
| - ui::MotionEventAndroid event(1.f / dpi_scale(),
|
| + MotionEventAndroid event(1.f / dpi_scale(),
|
| env,
|
| motion_event,
|
| time_ms,
|
| @@ -946,6 +958,8 @@ jboolean ContentViewCoreImpl::OnTouchEvent(
|
| &pointer0,
|
| &pointer1);
|
|
|
| + RecordToolTypeForActionDown(event);
|
| +
|
| return is_touch_handle_event ? rwhv->OnTouchHandleEvent(event)
|
| : rwhv->OnTouchEvent(event);
|
| }
|
| @@ -973,11 +987,11 @@ jboolean ContentViewCoreImpl::SendMouseEvent(
|
| // Construct a motion_event object minimally, only to convert the raw
|
| // parameters to ui::MotionEvent values. Since we used only the cached values
|
| // at index=0, it is okay to even pass a null event to the constructor.
|
| - ui::MotionEventAndroid::Pointer pointer0(
|
| + MotionEventAndroid::Pointer pointer0(
|
| pointer_id, x, y, 0.0f /* touch_major */, 0.0f /* touch_minor */,
|
| orientation, tilt, android_tool_type);
|
|
|
| - ui::MotionEventAndroid motion_event(1.f / dpi_scale(),
|
| + MotionEventAndroid motion_event(1.f / dpi_scale(),
|
| env,
|
| nullptr /* event */,
|
| time_ms,
|
| @@ -992,6 +1006,8 @@ jboolean ContentViewCoreImpl::SendMouseEvent(
|
| &pointer0,
|
| nullptr);
|
|
|
| + RecordToolTypeForActionDown(motion_event);
|
| +
|
| // Note: This relies on identical button enum values in MotionEvent and
|
| // MotionEventAndroid.
|
| rwhv->SendMouseEvent(motion_event, android_changed_button);
|
|
|