eche_notification_click_handler.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_WEBUI_ECHE_APP_UI_ECHE_NOTIFICATION_CLICK_HANDLER_H_
  5. #define ASH_WEBUI_ECHE_APP_UI_ECHE_NOTIFICATION_CLICK_HANDLER_H_
  6. #include "ash/components/phonehub/notification.h"
  7. #include "ash/components/phonehub/notification_click_handler.h"
  8. #include "ash/components/phonehub/notification_interaction_handler.h"
  9. // TODO(https://crbug.com/1164001): move to forward declaration.
  10. #include "ash/components/phonehub/phone_hub_manager.h"
  11. #include "ash/webui/eche_app_ui/feature_status_provider.h"
  12. #include "base/callback.h"
  13. namespace ash {
  14. namespace eche_app {
  15. class LaunchAppHelper;
  16. // Handles notification clicks originating from Phone Hub notifications.
  17. class EcheNotificationClickHandler : public phonehub::NotificationClickHandler,
  18. public FeatureStatusProvider::Observer {
  19. public:
  20. EcheNotificationClickHandler(phonehub::PhoneHubManager* phone_hub_manager,
  21. FeatureStatusProvider* feature_status_provider,
  22. LaunchAppHelper* launch_app_helper);
  23. ~EcheNotificationClickHandler() override;
  24. EcheNotificationClickHandler(const EcheNotificationClickHandler&) = delete;
  25. EcheNotificationClickHandler& operator=(const EcheNotificationClickHandler&) =
  26. delete;
  27. // phonehub::NotificationClickHandler:
  28. void HandleNotificationClick(
  29. int64_t notification_id,
  30. const phonehub::Notification::AppMetadata& app_metadata) override;
  31. // FeatureStatusProvider::Observer:
  32. void OnFeatureStatusChanged() override;
  33. private:
  34. bool IsClickable(FeatureStatus status);
  35. phonehub::NotificationInteractionHandler* handler_;
  36. FeatureStatusProvider* feature_status_provider_;
  37. LaunchAppHelper* launch_app_helper_;
  38. bool is_click_handler_set_ = false;
  39. };
  40. } // namespace eche_app
  41. } // namespace ash
  42. #endif // ASH_WEBUI_ECHE_APP_UI_ECHE_NOTIFICATION_CLICK_HANDLER_H_