effective_connection_type_observer.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2017 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 NET_NQE_EFFECTIVE_CONNECTION_TYPE_OBSERVER_H_
  5. #define NET_NQE_EFFECTIVE_CONNECTION_TYPE_OBSERVER_H_
  6. #include "base/compiler_specific.h"
  7. #include "net/base/net_export.h"
  8. #include "net/nqe/effective_connection_type.h"
  9. namespace net {
  10. // Observes changes in effective connection type.
  11. class NET_EXPORT_PRIVATE EffectiveConnectionTypeObserver {
  12. public:
  13. EffectiveConnectionTypeObserver(const EffectiveConnectionTypeObserver&) =
  14. delete;
  15. EffectiveConnectionTypeObserver& operator=(
  16. const EffectiveConnectionTypeObserver&) = delete;
  17. // Notifies the observer of a change in the effective connection type.
  18. // NetworkQualityEstimator computes the effective connection type once in
  19. // every interval of duration
  20. // |effective_connection_type_recomputation_interval_|. Additionally, when
  21. // there is a change in the connection type of the device, then the
  22. // effective connection type is immediately recomputed.
  23. //
  24. // If the computed effective connection type is different from the
  25. // previously notified effective connection type, then all the registered
  26. // observers are notified of the new effective connection type.
  27. virtual void OnEffectiveConnectionTypeChanged(
  28. EffectiveConnectionType type) = 0;
  29. protected:
  30. EffectiveConnectionTypeObserver() = default;
  31. virtual ~EffectiveConnectionTypeObserver() = default;
  32. };
  33. } // namespace net
  34. #endif // NET_NQE_EFFECTIVE_CONNECTION_TYPE_OBSERVER_H_