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.cc

Issue 2347783003: [OfflinePages, NetworkQualityEstimator] Use NetworkQualityEstimator to decide on triggering Backgro… (Closed)
Patch Set: Addresses some 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 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h" 5 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/io_thread.h" 9 #include "chrome/browser/io_thread.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "net/nqe/network_quality_estimator.h" 11 #include "net/nqe/network_quality_estimator.h"
tbansal1 2016/09/16 22:05:55 nit: Remove this include since it is already in th
dougarnett 2016/09/19 19:34:32 Done.
12 12
13 // A class that sets itself as an observer of the EffectiveconnectionType for 13 // A class that sets itself as an observer of the EffectiveconnectionType for
14 // the browser IO thread. It reports any change in EffectiveConnectionType back 14 // the browser IO thread. It reports any change in EffectiveConnectionType back
15 // to the UI service. 15 // to the UI service.
16 // It is created on the UI thread, but used and deleted on the IO thread. 16 // It is created on the UI thread, but used and deleted on the IO thread.
17 class UINetworkQualityEstimatorService::IONetworkQualityObserver 17 class UINetworkQualityEstimatorService::IONetworkQualityObserver
18 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver { 18 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver {
19 public: 19 public:
20 IONetworkQualityObserver( 20 IONetworkQualityObserver(
21 base::WeakPtr<UINetworkQualityEstimatorService> service) 21 base::WeakPtr<UINetworkQualityEstimatorService> service)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 type_ = type; 97 type_ = type;
98 } 98 }
99 99
100 void UINetworkQualityEstimatorService::SetEffectiveConnectionTypeForTesting( 100 void UINetworkQualityEstimatorService::SetEffectiveConnectionTypeForTesting(
101 net::EffectiveConnectionType type) { 101 net::EffectiveConnectionType type) {
102 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 102 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
103 type_ = type; 103 type_ = type;
104 } 104 }
105 105
106 net::EffectiveConnectionType 106 net::EffectiveConnectionType
107 UINetworkQualityEstimatorService::GetEffectiveConnectionType() const { 107 UINetworkQualityEstimatorService::GetEffectiveConnectionType() {
108 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 108 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
109 return type_; 109 return type_;
110 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698