ui_broker.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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_QUICK_PAIR_UI_UI_BROKER_H_
  5. #define ASH_QUICK_PAIR_UI_UI_BROKER_H_
  6. #include "ash/quick_pair/ui/actions.h"
  7. #include "base/observer_list_types.h"
  8. namespace ash {
  9. namespace quick_pair {
  10. struct Device;
  11. // The UIBroker is the entry point for the UI component in the Quick Pair
  12. // system. It is responsible for brokering the 'show UI' calls to the correct
  13. // Presenter implementation, and exposing user actions taken on that UI.
  14. class UIBroker {
  15. public:
  16. class Observer : public base::CheckedObserver {
  17. public:
  18. virtual void OnDiscoveryAction(scoped_refptr<Device> device,
  19. DiscoveryAction action) = 0;
  20. virtual void OnCompanionAppAction(scoped_refptr<Device> device,
  21. CompanionAppAction action) = 0;
  22. virtual void OnPairingFailureAction(scoped_refptr<Device> device,
  23. PairingFailedAction action) = 0;
  24. virtual void OnAssociateAccountAction(scoped_refptr<Device> device,
  25. AssociateAccountAction action) = 0;
  26. };
  27. virtual ~UIBroker() = default;
  28. virtual void AddObserver(Observer* observer) = 0;
  29. virtual void RemoveObserver(Observer* observer) = 0;
  30. virtual void ShowDiscovery(scoped_refptr<Device> device) = 0;
  31. virtual void ShowPairing(scoped_refptr<Device> device) = 0;
  32. virtual void ShowPairingFailed(scoped_refptr<Device> device) = 0;
  33. virtual void ShowAssociateAccount(scoped_refptr<Device> device) = 0;
  34. virtual void ShowCompanionApp(scoped_refptr<Device> device) = 0;
  35. virtual void RemoveNotifications() = 0;
  36. };
  37. } // namespace quick_pair
  38. } // namespace ash
  39. #endif // ASH_QUICK_PAIR_UI_UI_BROKER_H_