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
3 // found in the LICENSE file.
5 #ifndef ASH_TOUCH_TOUCH_OBSERVER_UMA_H_
6 #define ASH_TOUCH_TOUCH_OBSERVER_UMA_H_
10 #include "ash/shell.h"
11 #include "base/memory/singleton.h"
12 #include "ui/gfx/geometry/point.h"
13 #include "ui/views/widget/widget.h"
21 // Records some touch/gesture event specific details (e.g. what gestures are
22 // targetted to which components etc.)
23 class ASH_EXPORT TouchUMA
{
25 enum GestureActionType
{
27 GESTURE_OMNIBOX_PINCH
,
28 GESTURE_OMNIBOX_SCROLL
,
29 GESTURE_TABSTRIP_PINCH
,
30 GESTURE_TABSTRIP_SCROLL
,
32 GESTURE_DESKTOP_SCROLL
,
33 GESTURE_DESKTOP_PINCH
,
34 GESTURE_WEBPAGE_PINCH
,
35 GESTURE_WEBPAGE_SCROLL
,
39 GESTURE_TABSWITCH_TAP
,
40 GESTURE_TABNOSWITCH_TAP
,
43 GESTURE_ROOTVIEWTOP_TAP
,
44 GESTURE_FRAMEMAXIMIZE_TAP
,
45 GESTURE_FRAMEVIEW_TAP
,
46 GESTURE_MAXIMIZE_DOUBLETAP
,
47 // NOTE: Add new action types only immediately above this line. Also,
48 // make sure the enum list in tools/histogram/histograms.xml is
49 // updated with any change in here.
53 // Returns the singleton instance.
54 static TouchUMA
* GetInstance();
56 void RecordGestureEvent(aura::Window
* target
,
57 const ui::GestureEvent
& event
);
58 void RecordGestureAction(GestureActionType action
);
59 void RecordTouchEvent(aura::Window
* target
,
60 const ui::TouchEvent
& event
);
63 friend struct DefaultSingletonTraits
<TouchUMA
>;
68 void UpdateTouchState(const ui::TouchEvent
& event
);
69 GestureActionType
FindGestureActionType(aura::Window
* window
,
70 const ui::GestureEvent
& event
);
72 bool is_single_finger_gesture_
;
73 // These are used to measure the number of touch-start events we receive in a
74 // quick succession, regardless of the target window.
75 bool touch_in_progress_
;
77 base::TimeDelta last_touch_down_time_
;
79 DISALLOW_COPY_AND_ASSIGN(TouchUMA
);
84 #endif // ASH_TOUCH_TOUCH_OBSERVER_UMA_H_