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

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

Powered by Google App Engine
This is Rietveld 408576698