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

Unified Diff: ui/views/bubble/bubble_delegate.cc

Issue 10021029: Propagate OnNativeWidgetMove to delegate/observers, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use |move_loop_widget_| and GetAttachedBrowserView, etc. Created 8 years, 8 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 | « ui/views/bubble/bubble_delegate.h ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_delegate.cc
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc
index 3942c9276f5521b67f289eeb29e351bf411331e0..11e2072b5f5feeaf5d1e236f45ac3f5230b662d3 100644
--- a/ui/views/bubble/bubble_delegate.cc
+++ b/ui/views/bubble/bubble_delegate.cc
@@ -171,19 +171,30 @@ NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView(
return new BubbleFrameView(arrow_location(), color(), margin());
}
+void BubbleDelegateView::OnWidgetClosing(Widget* widget) {
+ if (anchor_view() && anchor_view()->GetWidget() == widget)
+ anchor_view_ = NULL;
+}
+
void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget,
bool visible) {
- if (widget == GetWidget()) {
- if (visible) {
- if (border_widget_)
- border_widget_->Show();
- GetFocusManager()->SetFocusedView(GetInitiallyFocusedView());
- Widget* anchor_widget = anchor_view() ? anchor_view()->GetWidget() : NULL;
- if (anchor_widget && anchor_widget->GetTopLevelWidget())
- anchor_widget->GetTopLevelWidget()->DisableInactiveRendering();
- } else if (border_widget_) {
+ if (widget != GetWidget())
+ return;
+
+ Widget* anchor_widget = anchor_view() ? anchor_view()->GetWidget() : NULL;
+ if (visible) {
+ if (border_widget_)
+ border_widget_->Show();
+ if (anchor_widget)
+ anchor_widget->AddObserver(this);
+ GetFocusManager()->SetFocusedView(GetInitiallyFocusedView());
+ if (anchor_widget && anchor_widget->GetTopLevelWidget())
+ anchor_widget->GetTopLevelWidget()->DisableInactiveRendering();
+ } else {
+ if (border_widget_)
border_widget_->Hide();
- }
+ if (anchor_widget)
+ anchor_widget->RemoveObserver(this);
}
}
@@ -193,6 +204,11 @@ void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget,
GetWidget()->Close();
}
+void BubbleDelegateView::OnWidgetMove(Widget* widget) {
+ if (anchor_view() && anchor_view()->GetWidget() == widget)
+ SizeToContents();
+}
+
gfx::Rect BubbleDelegateView::GetAnchorRect() {
return anchor_view() ? anchor_view()->GetScreenBounds() : gfx::Rect();
}
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698