Chromium Code Reviews| Index: chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service.h b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| index 324e37b7a398b0d09e3759b584376d025be2e003..8ccb4720251ba22bc92aa3a41ae8485cf73611a7 100644 |
| --- a/chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| +++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| @@ -3,20 +3,21 @@ |
| // found in the LICENSE file. |
| #ifndef CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_ |
| #define CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_ |
| #include <map> |
| #include <memory> |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/observer_list.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| #include "net/nqe/cached_network_quality.h" |
| #include "net/nqe/effective_connection_type.h" |
| #include "net/nqe/network_id.h" |
| #include "net/nqe/network_quality_estimator.h" |
| class PrefRegistrySimple; |
| class Profile; |
| namespace net { |
| @@ -24,26 +25,32 @@ class NetworkQualitiesPrefsManager; |
| } |
| // UI service to determine the current EffectiveConnectionType. |
| class UINetworkQualityEstimatorService |
| : public KeyedService, |
| public net::NetworkQualityEstimator::NetworkQualityProvider { |
| public: |
| explicit UINetworkQualityEstimatorService(Profile* profile); |
| ~UINetworkQualityEstimatorService() override; |
| + // NetworkQualityProvider implmentation: |
|
tbansal1
2016/10/25 17:34:18
"implmentation"
typo
RyanSturm
2016/10/25 17:40:32
Done.
|
| + net::EffectiveConnectionType GetEffectiveConnectionType() const override; |
| + void AddEffectiveConnectionTypeObserver( |
|
tbansal1
2016/10/25 17:34:18
You might want to say that this must be called on
RyanSturm
2016/10/25 17:40:32
Done.
|
| + net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) |
| + override; |
| + void RemoveEffectiveConnectionTypeObserver( |
| + net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) |
| + override; |
| + |
| // Registers the profile-specific network quality estimator prefs. |
| static void RegisterProfilePrefs(PrefRegistrySimple* registry); |
| - // The current EffectiveConnectionType. |
| - net::EffectiveConnectionType GetEffectiveConnectionType() const override; |
| - |
| // Tests can manually set EffectiveConnectionType, but browser tests should |
| // expect that the EffectiveConnectionType could change. |
| void SetEffectiveConnectionTypeForTesting(net::EffectiveConnectionType type); |
| // Reads the prefs from the disk, parses them into a map of NetworkIDs and |
| // CachedNetworkQualities, and returns the map. |
| std::map<net::nqe::internal::NetworkID, |
| net::nqe::internal::CachedNetworkQuality> |
| ForceReadPrefsForTesting() const; |
| @@ -59,20 +66,25 @@ class UINetworkQualityEstimatorService |
| // reported by NetworkchangeNotifier::GetConnectionType. |
| void EffectiveConnectionTypeChanged(net::EffectiveConnectionType type); |
| // The current EffectiveConnectionType. |
| net::EffectiveConnectionType type_; |
| // IO thread based observer that is owned by this service. Created on the UI |
| // thread, but used and deleted on the IO thread. |
| std::unique_ptr<IONetworkQualityObserver> io_observer_; |
| + // Observer list for changes in effective connection type. |
| + base::ObserverList< |
| + net::NetworkQualityEstimator::EffectiveConnectionTypeObserver> |
| + effective_connection_type_observer_list_; |
| + |
| // Prefs manager that is owned by this service. Created on the UI thread, but |
| // used and deleted on the IO thread. |
| std::unique_ptr<net::NetworkQualitiesPrefsManager> prefs_manager_; |
| base::WeakPtrFactory<UINetworkQualityEstimatorService> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(UINetworkQualityEstimatorService); |
| }; |
| #endif // CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_ |