message_center_controller.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_MESSAGE_CENTER_CONTROLLER_H_
  5. #define ASH_SYSTEM_MESSAGE_CENTER_MESSAGE_CENTER_CONTROLLER_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ash/public/cpp/message_center/arc_notifications_host_initializer.h"
  9. #include "ash/public/cpp/session/session_observer.h"
  10. #include "base/observer_list.h"
  11. #include "mojo/public/cpp/bindings/pending_remote.h"
  12. class PrefRegistrySimple;
  13. namespace message_center {
  14. class NotificationBlocker;
  15. }
  16. namespace ash {
  17. class ArcNotificationManagerBase;
  18. class FullscreenNotificationBlocker;
  19. class PhoneHubNotificationController;
  20. class InactiveUserNotificationBlocker;
  21. class SessionStateNotificationBlocker;
  22. // This class manages the ash message center and allows clients (like Chrome) to
  23. // add and remove notifications.
  24. class ASH_EXPORT MessageCenterController
  25. : public ArcNotificationsHostInitializer,
  26. public SessionObserver {
  27. public:
  28. static void RegisterProfilePrefs(PrefRegistrySimple* registry);
  29. MessageCenterController();
  30. MessageCenterController(const MessageCenterController&) = delete;
  31. MessageCenterController& operator=(const MessageCenterController&) = delete;
  32. ~MessageCenterController() override;
  33. // ArcNotificationsHostInitializer:
  34. void SetArcNotificationManagerInstance(
  35. std::unique_ptr<ArcNotificationManagerBase> manager_instance) override;
  36. ArcNotificationManagerBase* GetArcNotificationManagerInstance() override;
  37. void AddObserver(Observer* observer) override;
  38. void RemoveObserver(Observer* observer) override;
  39. // SessionObserver:
  40. void OnActiveUserPrefServiceChanged(PrefService* pref_service) override;
  41. InactiveUserNotificationBlocker*
  42. inactive_user_notification_blocker_for_testing() {
  43. return inactive_user_notification_blocker_.get();
  44. }
  45. PhoneHubNotificationController* phone_hub_notification_controller() {
  46. return phone_hub_notification_controller_.get();
  47. }
  48. private:
  49. std::unique_ptr<FullscreenNotificationBlocker>
  50. fullscreen_notification_blocker_;
  51. std::unique_ptr<InactiveUserNotificationBlocker>
  52. inactive_user_notification_blocker_;
  53. std::unique_ptr<SessionStateNotificationBlocker>
  54. session_state_notification_blocker_;
  55. std::unique_ptr<message_center::NotificationBlocker> all_popup_blocker_;
  56. std::unique_ptr<ArcNotificationManagerBase> arc_notification_manager_;
  57. std::unique_ptr<PhoneHubNotificationController>
  58. phone_hub_notification_controller_;
  59. base::ObserverList<Observer> observers_;
  60. };
  61. } // namespace ash
  62. #endif // ASH_SYSTEM_MESSAGE_CENTER_MESSAGE_CENTER_CONTROLLER_H_