Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ | 5 #ifndef ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ |
| 6 #define ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ | 6 #define ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/memory/singleton.h" | |
| 11 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
| 12 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 13 | 14 |
| 14 namespace aura { | 15 namespace aura { |
| 15 class Window; | 16 class Window; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 namespace internal { | 20 namespace internal { |
|
sky
2013/06/26 23:42:55
Since this class is used outside of chrome it shou
tdanderson
2013/06/27 22:39:33
Done.
| |
| 20 | 21 |
| 21 // Records some touch/gesture event specific details (e.g. what gestures are | 22 // Records some touch/gesture event specific details (e.g. what gestures are |
| 22 // targetted to which components etc.) | 23 // targetted to which components etc.) |
| 23 class TouchUMA { | 24 class ASH_EXPORT TouchUMA { |
| 24 public: | 25 public: |
| 25 TouchUMA(); | 26 enum GestureActionType { |
| 26 ~TouchUMA(); | 27 GESTURE_UNKNOWN, |
| 28 GESTURE_OMNIBOX_PINCH, | |
| 29 GESTURE_OMNIBOX_SCROLL, | |
| 30 GESTURE_TABSTRIP_PINCH, | |
| 31 GESTURE_TABSTRIP_SCROLL, | |
| 32 GESTURE_BEZEL_SCROLL, | |
| 33 GESTURE_DESKTOP_SCROLL, | |
| 34 GESTURE_DESKTOP_PINCH, | |
| 35 GESTURE_WEBPAGE_PINCH, | |
| 36 GESTURE_WEBPAGE_SCROLL, | |
| 37 GESTURE_WEBPAGE_TAP, | |
| 38 GESTURE_TABSTRIP_TAP, | |
| 39 GESTURE_BEZEL_DOWN, | |
| 40 GESTURE_TABSWITCH_TAP, | |
| 41 GESTURE_TABNOSWITCH_TAP, | |
| 42 GESTURE_TABCLOSE_TAP, | |
| 43 GESTURE_NEWTAB_TAP, | |
| 44 GESTURE_FRAMEMAXIMIZE_TAP, | |
| 45 GESTURE_FRAMEVIEW_TAP, | |
| 46 GESTURE_ROOTVIEWTOP_TAP, | |
| 47 GESTURE_MAXIMIZE_DOUBLETAP, | |
| 48 // NOTE: Add new action types only immediately above this line. Also, | |
| 49 // make sure the enum list in tools/histogram/histograms.xml is | |
| 50 // updated with any change in here. | |
| 51 GESTURE_ACTION_COUNT | |
| 52 }; | |
| 53 | |
| 54 // Returns the singleton instance. | |
| 55 static TouchUMA* GetInstance(); | |
| 27 | 56 |
| 28 void RecordGestureEvent(aura::Window* target, | 57 void RecordGestureEvent(aura::Window* target, |
| 29 const ui::GestureEvent& event); | 58 const ui::GestureEvent& event); |
| 59 void RecordGestureAction(GestureActionType action); | |
| 30 void RecordTouchEvent(aura::Window* target, | 60 void RecordTouchEvent(aura::Window* target, |
| 31 const ui::TouchEvent& event); | 61 const ui::TouchEvent& event); |
| 32 | 62 |
| 33 private: | 63 private: |
| 64 friend struct DefaultSingletonTraits<TouchUMA>; | |
| 65 | |
| 66 TouchUMA(); | |
| 67 ~TouchUMA(); | |
| 68 | |
| 34 void UpdateBurstData(const ui::TouchEvent& event); | 69 void UpdateBurstData(const ui::TouchEvent& event); |
| 70 GestureActionType FindGestureActionType(aura::Window* window, | |
| 71 const ui::GestureEvent& event); | |
| 35 | 72 |
| 36 // These are used to measure the number of touch-start events we receive in a | 73 // These are used to measure the number of touch-start events we receive in a |
| 37 // quick succession, regardless of the target window. | 74 // quick succession, regardless of the target window. |
| 38 bool touch_in_progress_; | 75 bool touch_in_progress_; |
| 39 int burst_length_; | 76 int burst_length_; |
| 40 base::TimeDelta last_touch_down_time_; | 77 base::TimeDelta last_touch_down_time_; |
| 41 | 78 |
| 42 DISALLOW_COPY_AND_ASSIGN(TouchUMA); | 79 DISALLOW_COPY_AND_ASSIGN(TouchUMA); |
| 43 }; | 80 }; |
| 44 | 81 |
| 45 } // namespace internal | 82 } // namespace internal |
| 46 } // namespace ash | 83 } // namespace ash |
| 47 | 84 |
| 48 #endif // ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ | 85 #endif // ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ |
| OLD | NEW |