| 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..70da63a0acd92803fe9ac65be64b6202140fc842 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_showing_count_ = 0;
|
| +
|
| } // namespace
|
|
|
| namespace internal {
|
| @@ -225,6 +229,11 @@ TrayBubbleView::~TrayBubbleView() {
|
| delegate_->BubbleViewDestroyed();
|
| }
|
|
|
| +// static
|
| +bool TrayBubbleView::IsATrayBubbleOpen() {
|
| + return g_current_tray_bubble_showing_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_showing_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_showing_count_;
|
| + DCHECK_GE(g_current_tray_bubble_showing_count_, 0);
|
| +}
|
| +
|
| NonClientFrameView* TrayBubbleView::CreateNonClientFrameView(Widget* widget) {
|
| BubbleFrameView* frame = static_cast<BubbleFrameView*>(
|
| BubbleDialogDelegateView::CreateNonClientFrameView(widget));
|
|
|