Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: ui/views/corewm/tooltip_controller.h

Issue 2615993002: Remove unnecessary spin in ToolTipController (Closed)
Patch Set: Fix unit tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <memory> 9 #include <memory>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void OnCancelMode(ui::CancelModeEvent* event) override; 51 void OnCancelMode(ui::CancelModeEvent* event) override;
52 52
53 // Overridden from aura::WindowObserver. 53 // Overridden from aura::WindowObserver.
54 void OnWindowDestroyed(aura::Window* window) override; 54 void OnWindowDestroyed(aura::Window* window) override;
55 55
56 const gfx::Point& mouse_location() const { return curr_mouse_loc_; } 56 const gfx::Point& mouse_location() const { return curr_mouse_loc_; }
57 57
58 private: 58 private:
59 friend class test::TooltipControllerTestHelper; 59 friend class test::TooltipControllerTestHelper;
60 60
61 void TooltipTimerFired();
62 void TooltipShownTimerFired(); 61 void TooltipShownTimerFired();
63 62
64 // Updates the tooltip if required (if there is any change in the tooltip 63 // Updates the tooltip if required (if there is any change in the tooltip
65 // text, tooltip id or the aura::Window). 64 // text, tooltip id or the aura::Window).
66 void UpdateIfRequired(); 65 void UpdateIfRequired();
67 66
68 // Only used in tests. 67 // Only used in tests.
69 bool IsTooltipVisible(); 68 bool IsTooltipVisible();
70 69
71 bool IsDragDropInProgress(); 70 bool IsDragDropInProgress();
(...skipping 11 matching lines...) Expand all
83 aura::Window* tooltip_window_; 82 aura::Window* tooltip_window_;
84 base::string16 tooltip_text_; 83 base::string16 tooltip_text_;
85 const void* tooltip_id_; 84 const void* tooltip_id_;
86 85
87 // These fields are for tracking state when the user presses a mouse button. 86 // These fields are for tracking state when the user presses a mouse button.
88 aura::Window* tooltip_window_at_mouse_press_; 87 aura::Window* tooltip_window_at_mouse_press_;
89 base::string16 tooltip_text_at_mouse_press_; 88 base::string16 tooltip_text_at_mouse_press_;
90 89
91 std::unique_ptr<Tooltip> tooltip_; 90 std::unique_ptr<Tooltip> tooltip_;
92 91
93 base::RepeatingTimer tooltip_timer_;
94
95 // Timer to timeout the life of an on-screen tooltip. We hide the tooltip when 92 // Timer to timeout the life of an on-screen tooltip. We hide the tooltip when
96 // this timer fires. 93 // this timer fires.
97 base::OneShotTimer tooltip_shown_timer_; 94 base::OneShotTimer tooltip_shown_timer_;
98 95
99 // Location of the last event in |tooltip_window_|'s coordinates. 96 // Location of the last event in |tooltip_window_|'s coordinates.
100 gfx::Point curr_mouse_loc_; 97 gfx::Point curr_mouse_loc_;
101 98
102 bool tooltips_enabled_; 99 bool tooltips_enabled_;
103 100
104 std::map<aura::Window*, int> tooltip_shown_timeout_map_; 101 std::map<aura::Window*, int> tooltip_shown_timeout_map_;
105 102
106 DISALLOW_COPY_AND_ASSIGN(TooltipController); 103 DISALLOW_COPY_AND_ASSIGN(TooltipController);
107 }; 104 };
108 105
109 } // namespace corewm 106 } // namespace corewm
110 } // namespace views 107 } // namespace views
111 108
112 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ 109 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698