[go: nahoru, domu]

Show system tray on views based shelf.

Add basic logic to show system tray from LoginScreenController. It
removes need for chrome control over this part of UI.

Do not show views based shelf in OOBE, because it still strongly relies
on web UI.

Bug: 792656, 798869

Do not show views based shelf in OOBE.

Change-Id: Ia50695c44f9e78b7fc50c5e97dafd108ef1876a5
Reviewed-on: https://chromium-review.googlesource.com/848425
Commit-Queue: Aga Wronska <agawronska@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528818}
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc
index 52a0855..888d927 100644
--- a/ash/login/login_screen_controller.cc
+++ b/ash/login/login_screen_controller.cc
@@ -8,8 +8,10 @@
 #include "ash/login/ui/lock_screen.h"
 #include "ash/login/ui/login_data_dispatcher.h"
 #include "ash/public/cpp/ash_pref_names.h"
+#include "ash/root_window_controller.h"
 #include "ash/session/session_controller.h"
 #include "ash/shell.h"
+#include "ash/system/status_area_widget.h"
 #include "base/strings/string_number_conversions.h"
 #include "chromeos/cryptohome/system_salt_getter.h"
 #include "chromeos/login/auth/authpolicy_login_helper.h"
@@ -30,6 +32,13 @@
   return key.GetSecret();
 }
 
+void SetSystemTrayVisibility(bool visible) {
+  auto* status_area =
+      Shell::GetPrimaryRootWindowController()->GetStatusAreaWidget();
+  if (status_area)
+    status_area->SetSystemTrayVisibility(visible);
+}
+
 }  // namespace
 
 LoginScreenController::LoginScreenController() : weak_factory_(this) {}
@@ -60,6 +69,7 @@
 void LoginScreenController::ShowLockScreen(ShowLockScreenCallback on_shown) {
   ash::LockScreen::Show(ash::LockScreen::ScreenType::kLock);
   std::move(on_shown).Run(true);
+  SetSystemTrayVisibility(true);
 }
 
 void LoginScreenController::ShowLoginScreen(ShowLoginScreenCallback on_shown) {
@@ -73,6 +83,7 @@
   // TODO(jdufault): rename ash::LockScreen to ash::LoginScreen.
   ash::LockScreen::Show(ash::LockScreen::ScreenType::kLogin);
   std::move(on_shown).Run(true);
+  SetSystemTrayVisibility(true);
 }
 
 void LoginScreenController::ShowErrorMessage(int32_t login_attempts,