Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 2536413003: Added UMA counters for Android tool-types. (Closed)
Patch Set: Add MotionEvent.TOOL_TYPE_LAST etc. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698