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 | 20 |
| 21 // Records some touch/gesture event specific details (e.g. what gestures are | 21 // Records some touch/gesture event specific details (e.g. what gestures are |
| 22 // targetted to which components etc.) | 22 // targetted to which components etc.) |
| 23 class TouchUMA { | 23 class ASH_EXPORT TouchUMA { |
| 24 public: | 24 public: |
| 25 TouchUMA(); | 25 enum GestureActionType { |
| 26 ~TouchUMA(); | 26 GESTURE_UNKNOWN, |
| 27 GESTURE_OMNIBOX_PINCH, | |
| 28 GESTURE_OMNIBOX_SCROLL, | |
| 29 GESTURE_TABSTRIP_PINCH, | |
| 30 GESTURE_TABSTRIP_SCROLL, | |
| 31 GESTURE_BEZEL_SCROLL, | |
| 32 GESTURE_DESKTOP_SCROLL, | |
| 33 GESTURE_DESKTOP_PINCH, | |
| 34 GESTURE_WEBPAGE_PINCH, | |
| 35 GESTURE_WEBPAGE_SCROLL, | |
| 36 GESTURE_WEBPAGE_TAP, | |
| 37 GESTURE_TABSTRIP_TAP, | |
| 38 GESTURE_BEZEL_DOWN, | |
| 39 GESTURE_FRAMEMAXIMIZE_TAP, | |
| 40 GESTURE_FRAMEVIEW_TAP, | |
| 41 GESTURE_MAXIMIZE_DOUBLETAP, | |
| 42 // NOTE: Add new action types only immediately above this line. Also, | |
| 43 // make sure the enum list in tools/histogram/histograms.xml is | |
| 44 // updated with any change in here. | |
| 45 GESTURE_ACTION_COUNT = 512 | |
|
sky
2013/06/27 23:09:35
I think it clearer if you define the types you hav
tdanderson
2013/06/28 18:45:16
Done.
| |
| 46 }; | |
| 47 | |
| 48 // Returns the singleton instance. | |
| 49 static TouchUMA* GetInstance(); | |
| 27 | 50 |
| 28 void RecordGestureEvent(aura::Window* target, | 51 void RecordGestureEvent(aura::Window* target, |
| 29 const ui::GestureEvent& event); | 52 const ui::GestureEvent& event); |
| 53 void RecordGestureAction(GestureActionType action); | |
| 30 void RecordTouchEvent(aura::Window* target, | 54 void RecordTouchEvent(aura::Window* target, |
| 31 const ui::TouchEvent& event); | 55 const ui::TouchEvent& event); |
| 32 | 56 |
| 33 private: | 57 private: |
| 58 friend struct DefaultSingletonTraits<TouchUMA>; | |
| 59 | |
| 60 TouchUMA(); | |
| 61 ~TouchUMA(); | |
| 62 | |
| 34 void UpdateBurstData(const ui::TouchEvent& event); | 63 void UpdateBurstData(const ui::TouchEvent& event); |
| 64 GestureActionType FindGestureActionType(aura::Window* window, | |
| 65 const ui::GestureEvent& event); | |
| 35 | 66 |
| 36 // These are used to measure the number of touch-start events we receive in a | 67 // These are used to measure the number of touch-start events we receive in a |
| 37 // quick succession, regardless of the target window. | 68 // quick succession, regardless of the target window. |
| 38 bool touch_in_progress_; | 69 bool touch_in_progress_; |
| 39 int burst_length_; | 70 int burst_length_; |
| 40 base::TimeDelta last_touch_down_time_; | 71 base::TimeDelta last_touch_down_time_; |
| 41 | 72 |
| 42 DISALLOW_COPY_AND_ASSIGN(TouchUMA); | 73 DISALLOW_COPY_AND_ASSIGN(TouchUMA); |
| 43 }; | 74 }; |
| 44 | 75 |
| 45 } // namespace internal | |
| 46 } // namespace ash | 76 } // namespace ash |
| 47 | 77 |
| 48 #endif // ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ | 78 #endif // ASH_TOUCH_TOUCH_OBSERVER_UMA_H_ |
| OLD | NEW |