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

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

Issue 2831233003: Remove ShouldBlockShelfAutoHide(). (Closed)
Patch Set: this won't work until https://codereview.chromium.org/2834943002 lands Created 3 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/tray_bubble_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/tray_bubble_view.cc
diff --git a/ui/views/bubble/tray_bubble_view.cc b/ui/views/bubble/tray_bubble_view.cc
index 3d7a93eecae09d4b4d6f03ab71aef2e27a33c54c..5ef22644ee86920a9bfa74f34de86779c8cea3b6 100644
--- a/ui/views/bubble/tray_bubble_view.cc
+++ b/ui/views/bubble/tray_bubble_view.cc
@@ -49,6 +49,10 @@ BubbleBorder::Arrow GetArrowAlignment(
return BubbleBorder::RIGHT_BOTTOM;
}
+// Only one TrayBubbleView is visible at a time, but there are cases where the
+// lifetimes of two different bubbles can overlap briefly.
+int g_current_tray_bubble_view_count_ = 0;
sky 2017/04/24 15:32:40 optional: name this g_current_tray_showing_count (
Evan Stade 2017/04/27 01:33:48 Done.
+
} // namespace
namespace internal {
@@ -225,6 +229,11 @@ TrayBubbleView::~TrayBubbleView() {
delegate_->BubbleViewDestroyed();
}
+// static
+bool TrayBubbleView::IsATrayBubbleOpen() {
+ return g_current_tray_bubble_view_count_ > 0;
+}
+
void TrayBubbleView::InitializeAndShowBubble() {
layer()->parent()->SetMaskLayer(bubble_content_mask_->layer());
@@ -232,6 +241,8 @@ void TrayBubbleView::InitializeAndShowBubble() {
GetWidget()->GetNativeWindow()->SetEventTargeter(
std::unique_ptr<ui::EventTargeter>(new BubbleWindowTargeter(this)));
UpdateBubble();
+
+ ++g_current_tray_bubble_view_count_;
}
void TrayBubbleView::UpdateBubble() {
@@ -278,6 +289,12 @@ void TrayBubbleView::OnBeforeBubbleWidgetInit(Widget::InitParams* params,
params->shadow_elevation = wm::ShadowElevation::LARGE;
}
+void TrayBubbleView::OnWidgetClosing(Widget* widget) {
+ BubbleDialogDelegateView::OnWidgetClosing(widget);
+ --g_current_tray_bubble_view_count_;
+ DCHECK_GE(g_current_tray_bubble_view_count_, 0);
+}
+
NonClientFrameView* TrayBubbleView::CreateNonClientFrameView(Widget* widget) {
BubbleFrameView* frame = static_cast<BubbleFrameView*>(
BubbleDialogDelegateView::CreateNonClientFrameView(widget));
« no previous file with comments | « ui/views/bubble/tray_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698