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

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

Issue 2625473002: Connect Login UI to SystemTray (Closed)
Patch Set: nits Created 3 years, 11 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 | « ash/common/system/tray/system_tray_controller.h ('k') | ash/public/interfaces/system_tray.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/system_tray_controller.cc
diff --git a/ash/common/system/tray/system_tray_controller.cc b/ash/common/system/tray/system_tray_controller.cc
index e4e8db7a03cc3969fcd39cb35f52332df9297ae4..5c8646eace83de4974b74aaa2c308e17bb17c504 100644
--- a/ash/common/system/tray/system_tray_controller.cc
+++ b/ash/common/system/tray/system_tray_controller.cc
@@ -127,6 +127,40 @@ void SystemTrayController::SetClient(mojom::SystemTrayClientPtr client) {
system_tray_client_ = std::move(client);
}
+void SystemTrayController::SetPrimaryTrayEnabled(bool enabled) {
+ ash::SystemTray* tray =
+ WmShell::Get()->GetPrimaryRootWindowController()->GetSystemTray();
+ if (!tray)
+ return;
+
+ // We disable the UI to prevent user from interacting with UI elements,
+ // particularly with the system tray menu. However, in case if the system tray
+ // bubble is opened at this point, it remains opened and interactive even
+ // after SystemTray::SetEnabled(false) call, which can be dangerous
+ // (http://crbug.com/497080). Close the menu to fix it. Calling
+ // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened
+ // until the UI is enabled again.
+ if (!enabled && tray->HasSystemBubble())
+ tray->CloseSystemBubble();
+
+ tray->SetEnabled(enabled);
+}
+
+void SystemTrayController::SetPrimaryTrayVisible(bool visible) {
+ ash::SystemTray* tray =
+ WmShell::Get()->GetPrimaryRootWindowController()->GetSystemTray();
+ if (!tray)
+ return;
+
+ tray->SetVisible(visible);
+ tray->GetWidget()->SetOpacity(visible ? 1.f : 0.f);
+ if (visible) {
+ tray->GetWidget()->Show();
+ } else {
+ tray->GetWidget()->Hide();
+ }
+}
+
void SystemTrayController::SetUse24HourClock(bool use_24_hour) {
hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock;
WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged();
« no previous file with comments | « ash/common/system/tray/system_tray_controller.h ('k') | ash/public/interfaces/system_tray.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698