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_TOOLTIPS_TOOLTIP_CONTROLLER_H_ | 5 #ifndef ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ |
6 #define ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ | 6 #define ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/timer.h" | 10 #include "base/timer.h" |
11 #include "ui/aura/client/tooltip_client.h" | 11 #include "ui/aura/client/tooltip_client.h" |
12 #include "ui/aura/event_filter.h" | 12 #include "ui/aura/event_filter.h" |
13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
14 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
15 #include "ui/gfx/point.h" | 15 #include "ui/gfx/point.h" |
16 | 16 |
17 namespace aura { | 17 namespace aura { |
18 class KeyEvent; | |
19 class MouseEvent; | |
20 class TouchEvent; | |
21 class Window; | 18 class Window; |
22 namespace client { | 19 namespace client { |
23 class DragDropClient; | 20 class DragDropClient; |
24 } | 21 } |
25 } | 22 } |
26 | 23 |
27 namespace ash { | 24 namespace ash { |
28 | 25 |
29 namespace test { | 26 namespace test { |
30 class TooltipControllerTest; | 27 class TooltipControllerTest; |
31 } // namespace test | 28 } // namespace test |
32 | 29 |
33 namespace internal { | 30 namespace internal { |
34 | 31 |
35 // TooltipController provides tooltip functionality for aura shell. | 32 // TooltipController provides tooltip functionality for aura shell. |
36 class ASH_EXPORT TooltipController : public aura::client::TooltipClient, | 33 class ASH_EXPORT TooltipController : public aura::client::TooltipClient, |
37 public aura::EventFilter, | 34 public aura::EventFilter, |
38 public aura::WindowObserver { | 35 public aura::WindowObserver { |
39 public: | 36 public: |
40 explicit TooltipController(aura::client::DragDropClient* drag_drop_client); | 37 explicit TooltipController(aura::client::DragDropClient* drag_drop_client); |
41 virtual ~TooltipController(); | 38 virtual ~TooltipController(); |
42 | 39 |
43 // Overridden from aura::client::TooltipClient. | 40 // Overridden from aura::client::TooltipClient. |
44 virtual void UpdateTooltip(aura::Window* target) OVERRIDE; | 41 virtual void UpdateTooltip(aura::Window* target) OVERRIDE; |
45 virtual void SetTooltipsEnabled(bool enable) OVERRIDE; | 42 virtual void SetTooltipsEnabled(bool enable) OVERRIDE; |
46 | 43 |
47 // Overridden from aura::EventFilter. | 44 // Overridden from aura::EventFilter. |
48 virtual bool PreHandleKeyEvent(aura::Window* target, | 45 virtual bool PreHandleKeyEvent(aura::Window* target, |
49 aura::KeyEvent* event) OVERRIDE; | 46 ui::KeyEvent* event) OVERRIDE; |
50 virtual bool PreHandleMouseEvent(aura::Window* target, | 47 virtual bool PreHandleMouseEvent(aura::Window* target, |
51 aura::MouseEvent* event) OVERRIDE; | 48 ui::MouseEvent* event) OVERRIDE; |
52 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 49 virtual ui::TouchStatus PreHandleTouchEvent( |
53 aura::TouchEvent* event) OVERRIDE; | 50 aura::Window* target, |
| 51 ui::TouchEventImpl* event) OVERRIDE; |
54 virtual ui::GestureStatus PreHandleGestureEvent(aura::Window* target, | 52 virtual ui::GestureStatus PreHandleGestureEvent(aura::Window* target, |
55 aura::GestureEvent* event) OVERRIDE; | 53 ui::GestureEventImpl* event) OVERRIDE; |
56 | 54 |
57 // Overridden from aura::WindowObserver. | 55 // Overridden from aura::WindowObserver. |
58 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 56 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
59 | 57 |
60 private: | 58 private: |
61 friend class ash::test::TooltipControllerTest; | 59 friend class ash::test::TooltipControllerTest; |
62 | 60 |
63 class Tooltip; | 61 class Tooltip; |
64 | 62 |
65 // Trims the tooltip to fit, setting |text| to the clipped result, | 63 // Trims the tooltip to fit, setting |text| to the clipped result, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 108 |
111 bool tooltips_enabled_; | 109 bool tooltips_enabled_; |
112 | 110 |
113 DISALLOW_COPY_AND_ASSIGN(TooltipController); | 111 DISALLOW_COPY_AND_ASSIGN(TooltipController); |
114 }; | 112 }; |
115 | 113 |
116 } // namespace internal | 114 } // namespace internal |
117 } // namespace ash | 115 } // namespace ash |
118 | 116 |
119 #endif // ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ | 117 #endif // ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ |
OLD | NEW |