fullscreen_notification_blocker.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2017 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. #ifndef ASH_SYSTEM_MESSAGE_CENTER_FULLSCREEN_NOTIFICATION_BLOCKER_H_
  5. #define ASH_SYSTEM_MESSAGE_CENTER_FULLSCREEN_NOTIFICATION_BLOCKER_H_
  6. #include "ash/shell_observer.h"
  7. #include "ui/message_center/notification_blocker.h"
  8. namespace ash {
  9. // A notification blocker which checks the fullscreen state.
  10. class FullscreenNotificationBlocker
  11. : public message_center::NotificationBlocker,
  12. public ShellObserver {
  13. public:
  14. explicit FullscreenNotificationBlocker(
  15. message_center::MessageCenter* message_center);
  16. FullscreenNotificationBlocker(const FullscreenNotificationBlocker&) = delete;
  17. FullscreenNotificationBlocker& operator=(
  18. const FullscreenNotificationBlocker&) = delete;
  19. ~FullscreenNotificationBlocker() override;
  20. static bool BlockForMixedFullscreen(
  21. const message_center::Notification& notification,
  22. bool is_fullscreen);
  23. // message_center::NotificationBlocker:
  24. bool ShouldShowNotificationAsPopup(
  25. const message_center::Notification& notification) const override;
  26. private:
  27. // ShellObserver:
  28. void OnFullscreenStateChanged(bool is_fullscreen,
  29. aura::Window* container) override;
  30. // Set to true if all displays have a fullscreen window.
  31. bool all_fullscreen_ = false;
  32. };
  33. } // namespace ash
  34. #endif // ASH_SYSTEM_MESSAGE_CENTER_FULLSCREEN_NOTIFICATION_BLOCKER_H_