| 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 9d336f4f85cfe2fa8e36f417544559fbaab3d12e..18f58268fc0e7364bd1d089a1b7db8a9f94321e2 100644
|
| --- a/chrome/browser/net/nqe/ui_network_quality_estimator_service.h
|
| +++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h
|
| @@ -7,18 +7,31 @@
|
|
|
| #include "base/macros.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "base/values.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 {
|
| +class NetworkQualitiesPrefsManager;
|
| +}
|
| +
|
| // UI service to determine the current EffectiveConnectionType.
|
| class UINetworkQualityEstimatorService
|
| : public KeyedService,
|
| public net::NetworkQualityEstimator::NetworkQualityProvider {
|
| public:
|
| - UINetworkQualityEstimatorService();
|
| + explicit UINetworkQualityEstimatorService(Profile* profile);
|
| ~UINetworkQualityEstimatorService() override;
|
|
|
| + // Registers the profile-specific network quality estimator prefs.
|
| + static void RegisterProfilePrefs(PrefRegistrySimple* registry);
|
| +
|
| // The current EffectiveConnectionType.
|
| net::EffectiveConnectionType GetEffectiveConnectionType() const override;
|
|
|
| @@ -26,6 +39,12 @@ class UINetworkQualityEstimatorService
|
| // 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;
|
| +
|
| private:
|
| class IONetworkQualityObserver;
|
|
|
| @@ -45,6 +64,10 @@ class UINetworkQualityEstimatorService
|
| // thread, but used and deleted on the IO thread.
|
| IONetworkQualityObserver* io_observer_;
|
|
|
| + // Prefs manager that is owned by this service. Created on the UI thread, but
|
| + // used and deleted on the IO thread.
|
| + net::NetworkQualitiesPrefsManager* prefs_manager_;
|
| +
|
| base::WeakPtrFactory<UINetworkQualityEstimatorService> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(UINetworkQualityEstimatorService);
|
|
|