notification_interaction_handler.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2021 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_COMPONENTS_PHONEHUB_NOTIFICATION_INTERACTION_HANDLER_H_
  5. #define ASH_COMPONENTS_PHONEHUB_NOTIFICATION_INTERACTION_HANDLER_H_
  6. #include <stdint.h>
  7. #include "ash/components/phonehub/notification.h"
  8. #include "ash/components/phonehub/notification_click_handler.h"
  9. #include "base/observer_list.h"
  10. #include "base/observer_list_types.h"
  11. namespace ash {
  12. namespace phonehub {
  13. // The handler that exposes the APIs to interact with Phone Hub Notification.
  14. class NotificationInteractionHandler {
  15. public:
  16. virtual ~NotificationInteractionHandler();
  17. // Called by PhoneHubNotificationController to notify the click event.
  18. virtual void HandleNotificationClicked(
  19. int64_t notification_id,
  20. const Notification::AppMetadata& app_metadata) = 0;
  21. virtual void AddNotificationClickHandler(NotificationClickHandler* handler);
  22. virtual void RemoveNotificationClickHandler(
  23. NotificationClickHandler* handler);
  24. protected:
  25. NotificationInteractionHandler();
  26. void NotifyNotificationClicked(int64_t notification_id,
  27. const Notification::AppMetadata& app_metadata);
  28. private:
  29. base::ObserverList<NotificationClickHandler> handler_list_;
  30. };
  31. } // namespace phonehub
  32. } // namespace ash
  33. #endif // ASH_COMPONENTS_PHONEHUB_NOTIFICATION_INTERACTION_HANDLER_H_