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 UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ |
6 #define UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ | 6 #define UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // TooltipController provides tooltip functionality for aura. | 32 // TooltipController provides tooltip functionality for aura. |
33 class VIEWS_EXPORT TooltipController : public aura::client::TooltipClient, | 33 class VIEWS_EXPORT TooltipController : public aura::client::TooltipClient, |
34 public ui::EventHandler, | 34 public ui::EventHandler, |
35 public aura::WindowObserver { | 35 public aura::WindowObserver { |
36 public: | 36 public: |
37 explicit TooltipController(scoped_ptr<Tooltip> tooltip); | 37 explicit TooltipController(scoped_ptr<Tooltip> tooltip); |
38 virtual ~TooltipController(); | 38 virtual ~TooltipController(); |
39 | 39 |
40 // Overridden from aura::client::TooltipClient. | 40 // Overridden from aura::client::TooltipClient. |
41 virtual void UpdateTooltip(aura::Window* target) OVERRIDE; | 41 virtual void UpdateTooltip(aura::Window* target, |
| 42 bool force) OVERRIDE; |
42 virtual void SetTooltipShownTimeout(aura::Window* target, | 43 virtual void SetTooltipShownTimeout(aura::Window* target, |
43 int timeout_in_ms) OVERRIDE; | 44 int timeout_in_ms) OVERRIDE; |
44 virtual void SetTooltipsEnabled(bool enable) OVERRIDE; | 45 virtual void SetTooltipsEnabled(bool enable) OVERRIDE; |
45 | 46 |
46 // Overridden from ui::EventHandler. | 47 // Overridden from ui::EventHandler. |
47 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 48 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
48 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 49 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
49 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | 50 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; |
50 virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE; | 51 virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE; |
51 | 52 |
52 // Overridden from aura::WindowObserver. | 53 // Overridden from aura::WindowObserver. |
53 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 54 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
54 | 55 |
55 const gfx::Point& mouse_location() const { return curr_mouse_loc_; } | 56 const gfx::Point& mouse_location() const { return curr_mouse_loc_; } |
56 | 57 |
57 private: | 58 private: |
58 friend class test::TooltipControllerTestHelper; | 59 friend class test::TooltipControllerTestHelper; |
59 | 60 |
60 void TooltipTimerFired(); | 61 void TooltipTimerFired(); |
61 void TooltipShownTimerFired(); | 62 void TooltipShownTimerFired(); |
62 | 63 |
63 // Updates the tooltip if required (if there is any change in the tooltip | 64 // Updates the tooltip if required (if there is any change in the tooltip |
64 // text or the aura::Window. | 65 // text or the aura::Window). If |force| is true the tooltip will be updated |
65 void UpdateIfRequired(); | 66 // regardless of these conditions. |
| 67 void UpdateIfRequired(bool force); |
66 | 68 |
67 // Only used in tests. | 69 // Only used in tests. |
68 bool IsTooltipVisible(); | 70 bool IsTooltipVisible(); |
69 | 71 |
70 bool IsDragDropInProgress(); | 72 bool IsDragDropInProgress(); |
71 | 73 |
72 // Returns true if the cursor is visible. | 74 // Returns true if the cursor is visible. |
73 bool IsCursorVisible(); | 75 bool IsCursorVisible(); |
74 | 76 |
75 int GetTooltipShownTimeout(); | 77 int GetTooltipShownTimeout(); |
(...skipping 25 matching lines...) Expand all Loading... |
101 | 103 |
102 std::map<aura::Window*, int> tooltip_shown_timeout_map_; | 104 std::map<aura::Window*, int> tooltip_shown_timeout_map_; |
103 | 105 |
104 DISALLOW_COPY_AND_ASSIGN(TooltipController); | 106 DISALLOW_COPY_AND_ASSIGN(TooltipController); |
105 }; | 107 }; |
106 | 108 |
107 } // namespace corewm | 109 } // namespace corewm |
108 } // namespace views | 110 } // namespace views |
109 | 111 |
110 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ | 112 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ |
OLD | NEW |