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_HUD_H_ | 5 #ifndef ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ |
6 #define ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ | 6 #define ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ |
7 | 7 |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ui/aura/event_filter.h" | 9 #include "ui/aura/event_filter.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
11 #include "ui/views/widget/widget_observer.h" | 11 #include "ui/views/widget/widget_observer.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 class MouseEvent; | |
15 class KeyEvent; | |
16 class Window; | 14 class Window; |
17 } | 15 } |
18 | 16 |
19 namespace views { | 17 namespace views { |
20 class Label; | 18 class Label; |
21 class Widget; | 19 class Widget; |
22 } | 20 } |
23 | 21 |
24 namespace ash { | 22 namespace ash { |
25 namespace internal { | 23 namespace internal { |
26 | 24 |
27 class TouchHudCanvas; | 25 class TouchHudCanvas; |
28 | 26 |
29 // An event filter which handles system level gesture events. | 27 // An event filter which handles system level gesture events. |
30 class TouchObserverHUD : public aura::EventFilter, | 28 class TouchObserverHUD : public aura::EventFilter, |
31 public views::WidgetObserver { | 29 public views::WidgetObserver { |
32 public: | 30 public: |
33 TouchObserverHUD(); | 31 TouchObserverHUD(); |
34 virtual ~TouchObserverHUD(); | 32 virtual ~TouchObserverHUD(); |
35 | 33 |
36 private: | 34 private: |
37 void UpdateTouchPointLabel(int index); | 35 void UpdateTouchPointLabel(int index); |
38 | 36 |
39 // Overriden from aura::EventFilter: | 37 // Overriden from aura::EventFilter: |
40 virtual bool PreHandleKeyEvent(aura::Window* target, | 38 virtual bool PreHandleKeyEvent(aura::Window* target, |
41 aura::KeyEvent* event) OVERRIDE; | 39 ui::KeyEvent* event) OVERRIDE; |
42 virtual bool PreHandleMouseEvent(aura::Window* target, | 40 virtual bool PreHandleMouseEvent(aura::Window* target, |
43 aura::MouseEvent* event) OVERRIDE; | 41 ui::MouseEvent* event) OVERRIDE; |
44 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 42 virtual ui::TouchStatus PreHandleTouchEvent( |
45 aura::TouchEvent* event) OVERRIDE; | 43 aura::Window* target, |
| 44 ui::TouchEventImpl* event) OVERRIDE; |
46 virtual ui::GestureStatus PreHandleGestureEvent( | 45 virtual ui::GestureStatus PreHandleGestureEvent( |
47 aura::Window* target, | 46 aura::Window* target, |
48 aura::GestureEvent* event) OVERRIDE; | 47 ui::GestureEventImpl* event) OVERRIDE; |
49 | 48 |
50 // Overridden from views::WidgetObserver: | 49 // Overridden from views::WidgetObserver: |
51 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 50 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
52 | 51 |
53 static const int kMaxTouchPoints = 32; | 52 static const int kMaxTouchPoints = 32; |
54 | 53 |
55 views::Widget* widget_; | 54 views::Widget* widget_; |
56 TouchHudCanvas* canvas_; | 55 TouchHudCanvas* canvas_; |
57 views::Label* touch_labels_[kMaxTouchPoints]; | 56 views::Label* touch_labels_[kMaxTouchPoints]; |
58 gfx::Point touch_positions_[kMaxTouchPoints]; | 57 gfx::Point touch_positions_[kMaxTouchPoints]; |
59 ui::EventType touch_status_[kMaxTouchPoints]; | 58 ui::EventType touch_status_[kMaxTouchPoints]; |
60 | 59 |
61 DISALLOW_COPY_AND_ASSIGN(TouchObserverHUD); | 60 DISALLOW_COPY_AND_ASSIGN(TouchObserverHUD); |
62 }; | 61 }; |
63 | 62 |
64 } // namespace internal | 63 } // namespace internal |
65 } // namespace ash | 64 } // namespace ash |
66 | 65 |
67 #endif // ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ | 66 #endif // ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ |
OLD | NEW |