Bring the browser window to the front when clicking on deprecated accelerator notific...
[chromium-blink-merge.git] / ash / touch / touch_uma.h
blob9e994149af9ea4ba732961e5d7c76a410009ce28
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_
8 #include <map>
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"
15 namespace aura {
16 class Window;
19 namespace ash {
21 // Records some touch/gesture event specific details (e.g. what gestures are
22 // targetted to which components etc.)
23 class ASH_EXPORT TouchUMA {
24 public:
25 enum GestureActionType {
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_TABSWITCH_TAP,
40 GESTURE_TABNOSWITCH_TAP,
41 GESTURE_TABCLOSE_TAP,
42 GESTURE_NEWTAB_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.
50 GESTURE_ACTION_COUNT
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);
62 private:
63 friend struct base::DefaultSingletonTraits<TouchUMA>;
65 TouchUMA();
66 ~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_;
76 int burst_length_;
77 base::TimeDelta last_touch_down_time_;
79 DISALLOW_COPY_AND_ASSIGN(TouchUMA);
82 } // namespace ash
84 #endif // ASH_TOUCH_TOUCH_OBSERVER_UMA_H_