quick_pair_feature_status_tracker_impl.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_
  5. #define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_
  6. #include <memory>
  7. #include "ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h"
  8. #include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h"
  9. #include "base/memory/weak_ptr.h"
  10. #include "base/observer_list.h"
  11. #include "base/observer_list_types.h"
  12. namespace ash {
  13. namespace quick_pair {
  14. class FeatureStatusTrackerImpl : public FeatureStatusTracker {
  15. public:
  16. FeatureStatusTrackerImpl();
  17. ~FeatureStatusTrackerImpl() override;
  18. void AddObserver(Observer* observer) override;
  19. void RemoveObserver(Observer* observer) override;
  20. bool IsFastPairEnabled() override;
  21. private:
  22. void OnFastPairEnabledChanged(bool is_enabled);
  23. base::ObserverList<Observer> observers_;
  24. std::unique_ptr<FastPairEnabledProvider> fast_pair_enabled_provider_;
  25. base::WeakPtrFactory<FeatureStatusTrackerImpl> weak_factory_{this};
  26. };
  27. } // namespace quick_pair
  28. } // namespace ash
  29. #endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_