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

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

Issue 2103323007: Exposing NQE on the Browser UI thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke comments Created 4 years, 5 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 | « chrome/browser/net/nqe/OWNERS ('k') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..0c11334ae70fe63e3b0be47ca2911d616a1da261
--- /dev/null
+++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// 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 "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "net/nqe/network_quality_estimator.h"
+
+class Profile;
+
+// UI service to determine the current EffectiveConnectionType.
+class UINetworkQualityEstimatorService : public KeyedService {
+ public:
+ explicit UINetworkQualityEstimatorService(Profile* profile);
+ ~UINetworkQualityEstimatorService() override;
+
+ // The current EffectiveConnectionType.
+ net::NetworkQualityEstimator::EffectiveConnectionType
+ GetEffectiveConnectionType() const;
+
+ private:
+ class IONetworkQualityObserver;
+
+ // KeyedService implementation:
+ void Shutdown() override;
+
+ // Called when the EffectiveConnectionType has updated to |type|.
+ // NetworkQualityEstimator::EffectiveConnectionType is an estimate of the
+ // quality of the network that may differ from the actual network type
+ // reported by NetworkchangeNotifier::GetConnectionType.
+ void EffectiveConnectionTypeChanged(
+ net::NetworkQualityEstimator::EffectiveConnectionType type);
+
+ // The current EffectiveConnectionType.
+ net::NetworkQualityEstimator::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.
+ IONetworkQualityObserver* io_observer_;
+
+ base::WeakPtrFactory<UINetworkQualityEstimatorService> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(UINetworkQualityEstimatorService);
+};
+
+#endif // CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
« no previous file with comments | « chrome/browser/net/nqe/OWNERS ('k') | 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