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

Side by Side Diff: chrome/browser/net/nqe/ui_network_quality_estimator_service.h

Issue 2347783003: [OfflinePages, NetworkQualityEstimator] Use NetworkQualityEstimator to decide on triggering Backgro… (Closed)
Patch Set: Addressed feedback Created 4 years, 3 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_ 5 #ifndef CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
6 #define CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_ 6 #define CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "components/keyed_service/core/keyed_service.h" 10 #include "components/keyed_service/core/keyed_service.h"
11 #include "net/nqe/effective_connection_type.h" 11 #include "net/nqe/effective_connection_type.h"
12 #include "net/nqe/network_quality_estimator.h"
12 13
13 // UI service to determine the current EffectiveConnectionType. 14 // UI service to determine the current EffectiveConnectionType.
14 class UINetworkQualityEstimatorService : public KeyedService { 15 class UINetworkQualityEstimatorService
16 : public KeyedService,
17 public net::NetworkQualityEstimator::NetworkQualityProvider {
15 public: 18 public:
16 UINetworkQualityEstimatorService(); 19 UINetworkQualityEstimatorService();
17 ~UINetworkQualityEstimatorService() override; 20 ~UINetworkQualityEstimatorService() override;
18 21
19 // The current EffectiveConnectionType. 22 // The current EffectiveConnectionType.
20 net::EffectiveConnectionType GetEffectiveConnectionType() const; 23 net::EffectiveConnectionType GetEffectiveConnectionType() const override;
21 24
22 // Tests can manually set EffectiveConnectionType, but browser tests should 25 // Tests can manually set EffectiveConnectionType, but browser tests should
23 // expect that the EffectiveConnectionType could change. 26 // expect that the EffectiveConnectionType could change.
24 void SetEffectiveConnectionTypeForTesting(net::EffectiveConnectionType type); 27 void SetEffectiveConnectionTypeForTesting(net::EffectiveConnectionType type);
25 28
26 private: 29 private:
27 class IONetworkQualityObserver; 30 class IONetworkQualityObserver;
28 31
29 // KeyedService implementation: 32 // KeyedService implementation:
30 void Shutdown() override; 33 void Shutdown() override;
(...skipping 10 matching lines...) Expand all
41 // IO thread based observer that is owned by this service. Created on the UI 44 // IO thread based observer that is owned by this service. Created on the UI
42 // thread, but used and deleted on the IO thread. 45 // thread, but used and deleted on the IO thread.
43 IONetworkQualityObserver* io_observer_; 46 IONetworkQualityObserver* io_observer_;
44 47
45 base::WeakPtrFactory<UINetworkQualityEstimatorService> weak_factory_; 48 base::WeakPtrFactory<UINetworkQualityEstimatorService> weak_factory_;
46 49
47 DISALLOW_COPY_AND_ASSIGN(UINetworkQualityEstimatorService); 50 DISALLOW_COPY_AND_ASSIGN(UINetworkQualityEstimatorService);
48 }; 51 };
49 52
50 #endif // CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_ 53 #endif // CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698