Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3995)

Unified Diff: chrome/browser/net/nqe/ui_network_quality_estimator_service.h

Issue 2369673004: Wire NQE Prefs to Profile (Closed)
Patch Set: More fixups Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/net/nqe/ui_network_quality_estimator_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..324e37b7a398b0d09e3759b584376d025be2e003 100644
--- a/chrome/browser/net/nqe/ui_network_quality_estimator_service.h
+++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h
@@ -5,20 +5,35 @@
#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 "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 +41,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;
@@ -43,7 +64,11 @@ class UINetworkQualityEstimatorService
// IO thread based observer that is owned by this service. Created on the UI
// thread, but used and deleted on the IO thread.
- IONetworkQualityObserver* io_observer_;
+ std::unique_ptr<IONetworkQualityObserver> io_observer_;
+
+ // 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_;
« no previous file with comments | « no previous file | chrome/browser/net/nqe/ui_network_quality_estimator_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698