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

Unified Diff: views/bubble/bubble_delegate.cc

Issue 8384020: Close new bubbles on deactivate; disable rendering Chrome inactive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the WS_POPUP style for non-modal dialogs. Created 9 years, 1 month 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/bubble/bubble_delegate.h ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/bubble/bubble_delegate.cc
diff --git a/views/bubble/bubble_delegate.cc b/views/bubble/bubble_delegate.cc
index 0fb15cc2b3f21ef4d6b5470d5744a2767968a6a3..e4a0c63844b1ce2d9cae5e3d493689ccf62aaa91 100644
--- a/views/bubble/bubble_delegate.cc
+++ b/views/bubble/bubble_delegate.cc
@@ -75,6 +75,7 @@ Widget* CreateBorderWidget(BubbleDelegateView* bubble, Widget* parent) {
BubbleDelegateView::BubbleDelegateView()
: close_on_esc_(true),
+ close_on_deactivate_(true),
allow_bubble_offscreen_(true),
arrow_location_(BubbleBorder::TOP_LEFT),
color_(SK_ColorWHITE),
@@ -88,6 +89,7 @@ BubbleDelegateView::BubbleDelegateView(
BubbleBorder::ArrowLocation arrow_location,
const SkColor& color)
: close_on_esc_(true),
+ close_on_deactivate_(true),
allow_bubble_offscreen_(true),
anchor_point_(anchor_point),
arrow_location_(arrow_location),
@@ -117,6 +119,9 @@ Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate,
bubble_widget->SetBounds(bubble_delegate->GetBubbleBounds());
#endif
+ bubble_widget->AddObserver(bubble_delegate);
+ if (parent_widget && parent_widget->GetTopLevelWidget())
+ parent_widget->GetTopLevelWidget()->DisableInactiveRendering();
return bubble_widget;
}
@@ -135,6 +140,14 @@ NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView() {
allow_bubble_offscreen_);
}
+void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget,
+ bool active) {
+ if (close_on_deactivate() && widget == GetWidget() && !active) {
+ GetWidget()->RemoveObserver(this);
+ GetWidget()->Close();
+ }
+}
+
gfx::Point BubbleDelegateView::GetAnchorPoint() {
return anchor_point_;
}
« no previous file with comments | « views/bubble/bubble_delegate.h ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698