Index: ui/events/gesture_detection/gesture_touch_uma_histogram.cc.save |
diff --git a/ui/events/gesture_detection/gesture_touch_uma_histogram.cc.save b/ui/events/gesture_detection/gesture_touch_uma_histogram.cc.save |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9bf9bf4e8afb4f55197e14887aad99996df9eef2 |
--- /dev/null |
+++ b/ui/events/gesture_detection/gesture_touch_uma_histogram.cc.save |
@@ -0,0 +1,82 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
tdresser
2014/08/27 12:35:39
This file looks like an accidental commit.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/events/gesture_detection/gesture_touch_uma_histogram.h" |
+ |
+#include "base/logging.h" |
+#include "base/metrics/histogram.h" |
+ |
+#include "ui/aura/env.h" |
+#include "ui/aura/window.h" |
+#include "ui/aura/window_event_dispatcher.h" |
+#include "ui/aura/window_property.h" |
+#include "ui/events/event.h" |
+#include "ui/events/gesture_detection/motion_event.h" |
+ |
+namespace ui { |
+ |
+GestureTouchUMAHistogram::GestureTouchUMAHistogram() { |
+} |
+ |
+GestureTouchUMAHistogram::~GestureTouchUMAHistogram() { |
+} |
+ |
+GestureTouchUMAHistogram::WindowTouchDetails::WindowTouchDetails() |
+ : max_distance_from_start_squared_(0) { |
+} |
+ |
+GestureTouchUMAHistogram::WindowTouchDetails::WindowTouchDetails(base::TimeTicks start_time, const gfx::Point& start_touch_position) |
+ : start_time_(start_time), |
+ start_touch_position_(start_touch_position), |
+ max_distance_from_start_squared_(0) { |
+} |
+ |
+GestureTouchUMAHistogram::WindowTouchDetails::~WindowTouchDetails() {} |
+ |
+void GestureTouchUMAHistogram::RecordGestureEvent( |
+ const ui::GestureEventData& gesture) { |
+ GestureEvent event(gesture.x, gesture.y, 1, gesture.time - base::TimeTicks(), gesture.details); |
+ UMA_HISTOGRAM_ENUMERATION("Event.GestureCreated", |
+ ui::UMAEventTypeFromEvent(event), ui::UMA_ET_COUNT); |
+ LOG(ERROR) << " gesture created in GestureTouchUMAHistogram "; |
+} |
+ |
+void GestureTouchUMAHistogram::RecordTouchEvent(const ui::MotionEvent& event) { |
+ EventType eventType = TouchEventTypeFromMotionEvent(event); |
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Event.TouchMaxDistance", |
+ static_cast<int>(sqrt(details->max_distance_from_start_squared_)), 0, |
+ 1500, 50); |
+ LOG(ERROR) << " TouchMaxDistance in GestureTouchUMAHistogram "; |
+ |
+ base::TimeDelta duration = event.GetEventTime() |
+ - details->start_time_; |
+ UMA_HISTOGRAM_TIMES("Event.TouchDuration2", duration); |
+ LOG(ERROR) << " TouchDuration2 in GestureTouchUMAHistogram "; |
+ } |
+ details.reset( new WindowTouchDetails()); |
+ } else if (eventType == ui::ET_TOUCH_MOVED) { |
+ float cur_dist = (details->start_touch_position_ - gfx::Point(event.GetX(), event.GetY())).LengthSquared(); |
+ if (cur_dist > details->max_distance_from_start_squared_) |
+ details->max_distance_from_start_squared_ = cur_dist; |
+ } else { |
+ details.reset( new WindowTouchDetails()); |
+ } |
+} |
+ |
+EventType GestureTouchUMAHistogram::TouchEventTypeFromMotionEvent(const MotionEvent& event) { |
+ switch (event.GetAction()) { |
+ case MotionEvent::ACTION_DOWN: |
+ return ET_TOUCH_PRESSED; |
+ case MotionEvent::ACTION_UP: |
+ return ET_TOUCH_RELEASED; |
+ case MotionEvent::ACTION_MOVE: |
+ return ET_TOUCH_MOVED; |
+ case MotionEvent::ACTION_CANCEL: |
+ return ET_TOUCH_CANCELLED; |
+ default: |
+ return ET_UNKNOWN; |
+ } |
+} |
+ |
+} // namespace ui |