summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 19:56:45 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 19:56:45 +0000
commit341b227d080d2aef8ee9b6a9bfc375513b22f718 (patch)
treeef217618a889c360f8dcf29801e1416733d1b285 /views
parent222e4548dafe0c7e2d4634034d8d54f3d7880a65 (diff)
downloadchromium_src-341b227d080d2aef8ee9b6a9bfc375513b22f718.zip
chromium_src-341b227d080d2aef8ee9b6a9bfc375513b22f718.tar.gz
chromium_src-341b227d080d2aef8ee9b6a9bfc375513b22f718.tar.bz2
Destroy tooltip manager if the native window is destroyed.
Also revert the previous attempt to fix this issue: Revert "Aura build fix: Make TooltipManagerViews an observer of parent Widget and" This reverts commit 6749813691870c8311c81c030bee9e1d4ad305ff. BUG=none TEST=none Review URL: http://codereview.chromium.org/8418028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107776 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/native_widget_aura.cc3
-rw-r--r--views/widget/tooltip_manager_views.cc12
-rw-r--r--views/widget/tooltip_manager_views.h9
3 files changed, 5 insertions, 19 deletions
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc
index 91bf443..6b100b1 100644
--- a/views/widget/native_widget_aura.cc
+++ b/views/widget/native_widget_aura.cc
@@ -540,6 +540,9 @@ void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) {
void NativeWidgetAura::OnWindowDestroying() {
delegate_->OnNativeWidgetDestroying();
+
+ // If the aura::Window is destroyed, we can no longer show tooltips.
+ tooltip_manager_.reset();
}
void NativeWidgetAura::OnWindowDestroyed() {
diff --git a/views/widget/tooltip_manager_views.cc b/views/widget/tooltip_manager_views.cc
index a7d367b..a8b6d97 100644
--- a/views/widget/tooltip_manager_views.cc
+++ b/views/widget/tooltip_manager_views.cc
@@ -75,8 +75,7 @@ int TooltipManager::GetMaxWidth(int x, int y) {
TooltipManagerViews::TooltipManagerViews(views::View* root_view)
: root_view_(root_view),
- tooltip_view_(NULL),
- widget_closed_(false) {
+ tooltip_view_(NULL) {
tooltip_label_.set_background(
views::Background::CreateSolidBackground(kTooltipBackground));
tooltip_widget_.reset(CreateTooltip());
@@ -87,7 +86,6 @@ TooltipManagerViews::TooltipManagerViews(views::View* root_view)
base::TimeDelta::FromMilliseconds(kTooltipTimeoutMs),
this, &TooltipManagerViews::TooltipTimerFired);
MessageLoopForUI::current()->AddObserver(this);
- root_view_->GetWidget()->AddObserver(this);
}
TooltipManagerViews::~TooltipManagerViews() {
@@ -152,11 +150,6 @@ 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);
}
@@ -179,9 +172,6 @@ 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)
diff --git a/views/widget/tooltip_manager_views.h b/views/widget/tooltip_manager_views.h
index d98914b..3d22662 100644
--- a/views/widget/tooltip_manager_views.h
+++ b/views/widget/tooltip_manager_views.h
@@ -27,8 +27,7 @@ class Widget;
// TooltipManager implementation for Views.
class TooltipManagerViews : public TooltipManager,
- public MessageLoopForUI::Observer,
- public Widget::Observer {
+ public MessageLoopForUI::Observer {
public:
explicit TooltipManagerViews(views::View* root_view);
virtual ~TooltipManagerViews();
@@ -49,9 +48,6 @@ class TooltipManagerViews : public TooltipManager,
virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
#endif
- // Widget::Observer
- virtual void OnWidgetClosing(Widget* widget) OVERRIDE;
-
private:
void TooltipTimerFired();
View* GetViewForTooltip(int x, int y, bool for_keyboard);
@@ -84,9 +80,6 @@ class TooltipManagerViews : public TooltipManager,
gfx::Point curr_mouse_pos_;
base::RepeatingTimer<TooltipManagerViews> tooltip_timer_;
- // true when the widget that owns us has closed.
- bool widget_closed_;
-
DISALLOW_COPY_AND_ASSIGN(TooltipManagerViews);
};