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

Unified Diff: views/widget/tooltip_manager_views.cc

Issue 8414012: Aura build fix: Make TooltipManagerViews an observer of parent Widget and (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/tooltip_manager_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/tooltip_manager_views.cc
diff --git a/views/widget/tooltip_manager_views.cc b/views/widget/tooltip_manager_views.cc
index a8b6d975d8852898a715d07d465747265714acae..a7d367bf487ba0f22d0ce8c98c1b24d70655db58 100644
--- a/views/widget/tooltip_manager_views.cc
+++ b/views/widget/tooltip_manager_views.cc
@@ -75,7 +75,8 @@ int TooltipManager::GetMaxWidth(int x, int y) {
TooltipManagerViews::TooltipManagerViews(views::View* root_view)
: root_view_(root_view),
- tooltip_view_(NULL) {
+ tooltip_view_(NULL),
+ widget_closed_(false) {
tooltip_label_.set_background(
views::Background::CreateSolidBackground(kTooltipBackground));
tooltip_widget_.reset(CreateTooltip());
@@ -86,6 +87,7 @@ TooltipManagerViews::TooltipManagerViews(views::View* root_view)
base::TimeDelta::FromMilliseconds(kTooltipTimeoutMs),
this, &TooltipManagerViews::TooltipTimerFired);
MessageLoopForUI::current()->AddObserver(this);
+ root_view_->GetWidget()->AddObserver(this);
}
TooltipManagerViews::~TooltipManagerViews() {
@@ -150,6 +152,11 @@ void TooltipManagerViews::DidProcessEvent(const base::NativeEvent& event) {
}
#endif
+void TooltipManagerViews::OnWidgetClosing(Widget* widget) {
+ tooltip_timer_.Stop();
+ widget_closed_ = true;
+}
+
void TooltipManagerViews::TooltipTimerFired() {
UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false);
}
@@ -172,6 +179,9 @@ View* TooltipManagerViews::GetViewForTooltip(int x, int y, bool for_keyboard) {
}
void TooltipManagerViews::UpdateIfRequired(int x, int y, bool for_keyboard) {
+ if (widget_closed_)
+ return;
+
View* view = GetViewForTooltip(x, y, for_keyboard);
string16 tooltip_text;
if (view)
« no previous file with comments | « views/widget/tooltip_manager_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698