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

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

Issue 2625473002: Connect Login UI to SystemTray (Closed)
Patch Set: 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
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..f869396ff774104b3c677045a1b73e98755fe00f 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 =
James Cook 2017/01/09 19:30:05 nit: no ash::, here and below
jonross 2017/01/09 22:01:35 Sadly they are, compiler incorrectly tries to link
+ WmShell::Get()->GetPrimaryRootWindowController()->GetSystemTray();
+ if (!tray)
+ return;
+
+ // We disable the UI to prevent user from interracting with UI elements,
James Cook 2017/01/09 19:30:05 nit: not your fault, but "interacting" here and "p
jonross 2017/01/09 22:01:35 I'm used to making these comment typos myself! WT
+ // particullary 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.0 : 0.0);
James Cook 2017/01/09 19:30:05 nit: 1.f and 0.f since the call takes floats
jonross 2017/01/09 22:01:35 Done.
+ 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();

Powered by Google App Engine
This is Rietveld 408576698