| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE; | 50 virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE; |
| 51 | 51 |
| 52 // Overridden from aura::WindowObserver. | 52 // Overridden from aura::WindowObserver. |
| 53 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 53 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 54 | 54 |
| 55 const gfx::Point& mouse_location() const { return curr_mouse_loc_; } | 55 const gfx::Point& mouse_location() const { return curr_mouse_loc_; } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 friend class test::TooltipControllerTestHelper; | 58 friend class test::TooltipControllerTestHelper; |
| 59 | 59 |
| 60 // Dispatches mouse events in a posted task. |
| 61 void DispatchMouseEvent(ui::EventType event_type, aura::Window* target); |
| 62 |
| 60 void TooltipTimerFired(); | 63 void TooltipTimerFired(); |
| 61 void TooltipShownTimerFired(); | 64 void TooltipShownTimerFired(); |
| 62 | 65 |
| 63 // Updates the tooltip if required (if there is any change in the tooltip | 66 // Updates the tooltip if required (if there is any change in the tooltip |
| 64 // text or the aura::Window. | 67 // text or the aura::Window. |
| 65 void UpdateIfRequired(); | 68 void UpdateIfRequired(); |
| 66 | 69 |
| 67 // Only used in tests. | 70 // Only used in tests. |
| 68 bool IsTooltipVisible(); | 71 bool IsTooltipVisible(); |
| 69 | 72 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 base::string16 tooltip_text_at_mouse_press_; | 90 base::string16 tooltip_text_at_mouse_press_; |
| 88 | 91 |
| 89 scoped_ptr<Tooltip> tooltip_; | 92 scoped_ptr<Tooltip> tooltip_; |
| 90 | 93 |
| 91 base::RepeatingTimer<TooltipController> tooltip_timer_; | 94 base::RepeatingTimer<TooltipController> tooltip_timer_; |
| 92 | 95 |
| 93 // Timer to timeout the life of an on-screen tooltip. We hide the tooltip when | 96 // Timer to timeout the life of an on-screen tooltip. We hide the tooltip when |
| 94 // this timer fires. | 97 // this timer fires. |
| 95 base::OneShotTimer<TooltipController> tooltip_shown_timer_; | 98 base::OneShotTimer<TooltipController> tooltip_shown_timer_; |
| 96 | 99 |
| 100 // Timer to throttle mouse movement events. |
| 101 base::OneShotTimer<TooltipController> mouse_event_timer_; |
| 102 |
| 103 // Location of the last event in screen coordinates. |
| 104 gfx::Point last_mouse_location_; |
| 105 |
| 97 // Location of the last event in |tooltip_window_|'s coordinates. | 106 // Location of the last event in |tooltip_window_|'s coordinates. |
| 98 gfx::Point curr_mouse_loc_; | 107 gfx::Point curr_mouse_loc_; |
| 99 | 108 |
| 100 bool tooltips_enabled_; | 109 bool tooltips_enabled_; |
| 101 | 110 |
| 102 std::map<aura::Window*, int> tooltip_shown_timeout_map_; | 111 std::map<aura::Window*, int> tooltip_shown_timeout_map_; |
| 103 | 112 |
| 104 DISALLOW_COPY_AND_ASSIGN(TooltipController); | 113 DISALLOW_COPY_AND_ASSIGN(TooltipController); |
| 105 }; | 114 }; |
| 106 | 115 |
| 107 } // namespace corewm | 116 } // namespace corewm |
| 108 } // namespace views | 117 } // namespace views |
| 109 | 118 |
| 110 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ | 119 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ |
| OLD | NEW |