notification_interaction_handler.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. #include "ash/components/phonehub/notification_interaction_handler.h"
  5. #include "ash/components/phonehub/notification.h"
  6. namespace ash {
  7. namespace phonehub {
  8. NotificationInteractionHandler::NotificationInteractionHandler() = default;
  9. NotificationInteractionHandler::~NotificationInteractionHandler() = default;
  10. void NotificationInteractionHandler::AddNotificationClickHandler(
  11. NotificationClickHandler* handler) {
  12. handler_list_.AddObserver(handler);
  13. }
  14. void NotificationInteractionHandler::RemoveNotificationClickHandler(
  15. NotificationClickHandler* handler) {
  16. handler_list_.RemoveObserver(handler);
  17. }
  18. void NotificationInteractionHandler::NotifyNotificationClicked(
  19. int64_t notification_id,
  20. const Notification::AppMetadata& app_metadata) {
  21. for (auto& handler : handler_list_)
  22. handler.HandleNotificationClick(notification_id, app_metadata);
  23. }
  24. } // namespace phonehub
  25. } // namespace ash