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

Side by Side 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: tbansal 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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
5 #ifndef CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
6 #define CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread_checker.h"
11 #include "components/keyed_service/core/keyed_service.h"
12 #include "net/nqe/network_quality_estimator.h"
13
14 class Profile;
15
16 namespace chrome_browser_net {
mmenke 2016/07/20 17:11:33 The currently preferred style is not to use the ch
RyanSturm 2016/07/20 17:37:38 Done.
17
18 // UI service to determine the current EffectiveConnectionType.
19 class UINetworkQualityEstimatorService : public KeyedService {
20 public:
21 explicit UINetworkQualityEstimatorService(Profile* profile);
22 ~UINetworkQualityEstimatorService() override;
23
24 // The current EffectiveConnectionType.
25 net::NetworkQualityEstimator::EffectiveConnectionType
26 GetEffectiveConnectionType() const;
27
28 private:
29 class IONetworkQualityObserver;
30
31 // KeyedService implementation:
32 void Shutdown() override;
33
34 // Called when the EffectiveConnectionType has updated to |type|.
35 // NetworkQualityEstimator::EffectiveConnectionType is an estimate of the
36 // quality of the network that may differ from the actual network type
37 // reported by NetworkchangeNotifier::GetConnectionType.
38 void EffectiveConnectionTypeChanged(
39 net::NetworkQualityEstimator::EffectiveConnectionType type);
40
41 // The current EffectiveConnectionType.
42 net::NetworkQualityEstimator::EffectiveConnectionType type_;
43
44 // IO thread based observer that is owned by this service. Created on the UI
45 // thread, but used and deleted on the IO thread.
46 IONetworkQualityObserver* io_observer_;
47 base::ThreadChecker thread_checker_;
48
49 base::WeakPtrFactory<UINetworkQualityEstimatorService> weak_factory_;
50
51 DISALLOW_COPY_AND_ASSIGN(UINetworkQualityEstimatorService);
52 };
53
54 } // namespace chrome_browser_net
55
56 #endif // CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698