arc_notification_manager_delegate_impl.cc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/system/message_center/arc_notification_manager_delegate_impl.h"
  5. #include "ash/login_status.h"
  6. #include "ash/root_window_controller.h"
  7. #include "ash/session/session_controller_impl.h"
  8. #include "ash/shell.h"
  9. #include "ash/system/message_center/message_center_controller.h"
  10. #include "ash/system/status_area_widget.h"
  11. #include "ash/system/unified/unified_system_tray.h"
  12. namespace ash {
  13. ArcNotificationManagerDelegateImpl::ArcNotificationManagerDelegateImpl() =
  14. default;
  15. ArcNotificationManagerDelegateImpl::~ArcNotificationManagerDelegateImpl() =
  16. default;
  17. bool ArcNotificationManagerDelegateImpl::IsPublicSessionOrKiosk() const {
  18. const LoginStatus login_status =
  19. Shell::Get()->session_controller()->login_status();
  20. return login_status == LoginStatus::PUBLIC ||
  21. login_status == LoginStatus::KIOSK_APP;
  22. }
  23. void ArcNotificationManagerDelegateImpl::ShowMessageCenter() {
  24. Shell::Get()
  25. ->GetPrimaryRootWindowController()
  26. ->GetStatusAreaWidget()
  27. ->unified_system_tray()
  28. ->ShowBubble();
  29. }
  30. void ArcNotificationManagerDelegateImpl::HideMessageCenter() {
  31. // Close the message center on all the displays.
  32. for (auto* root_window_controller :
  33. RootWindowController::root_window_controllers()) {
  34. root_window_controller->GetStatusAreaWidget()
  35. ->unified_system_tray()
  36. ->CloseBubble();
  37. }
  38. }
  39. } // namespace ash