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

Unified Diff: ash/common/system/tray/system_tray.cc

Issue 2754963002: Update cros network info bubble (Closed)
Patch Set: more clean up Created 3 years, 9 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
Index: ash/common/system/tray/system_tray.cc
diff --git a/ash/common/system/tray/system_tray.cc b/ash/common/system/tray/system_tray.cc
index 73c9fc6a137fb6eae3457e9db973ec705ebb12e2..c3c666cdca2165b456c1e08e5ab461daf245a8e1 100644
--- a/ash/common/system/tray/system_tray.cc
+++ b/ash/common/system/tray/system_tray.cc
@@ -69,6 +69,7 @@
#include "ui/views/controls/label.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
+#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_client.h"
@@ -178,10 +179,10 @@ class SystemTray::ActivationObserver
void OnWindowActivated(ActivationReason reason,
aura::Window* gained_active,
aura::Window* lost_active) override {
- WmWindow* wm_gained_active = WmWindow::Get(gained_active);
if (!tray_->HasSystemBubble() || !gained_active)
return;
+ WmWindow* wm_gained_active = WmWindow::Get(gained_active);
int container_id =
wm::GetContainerForWindow(wm_gained_active)->GetShellWindowId();
@@ -189,10 +190,19 @@ class SystemTray::ActivationObserver
if (container_id == kShellWindowId_StatusContainer)
return;
- if (tray_->GetSystemBubble()->bubble_view()->GetWidget() !=
- wm_gained_active->GetInternalWidget()) {
- tray_->CloseSystemBubble();
+ views::Widget* bubble_widget =
+ tray_->GetSystemBubble()->bubble_view()->GetWidget();
+ // Don't close the bubble if a transient child is gaining or losing
+ // activation.
+ if (bubble_widget == wm_gained_active->GetInternalWidget() ||
+ ::wm::HasTransientAncestor(gained_active,
+ bubble_widget->GetNativeWindow()) ||
+ ::wm::HasTransientAncestor(lost_active,
+ bubble_widget->GetNativeWindow())) {
+ return;
}
+
+ tray_->CloseSystemBubble();
}
private:

Powered by Google App Engine
This is Rietveld 408576698