Index: net/base/network_change_notifier.h |
diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h |
index abced4859a29857b493bf52012a0041ad6c9828b..bd27b42891c69466032b2e008f1ed5e7ff94f49c 100644 |
--- a/net/base/network_change_notifier.h |
+++ b/net/base/network_change_notifier.h |
@@ -186,14 +186,12 @@ class NET_EXPORT NetworkChangeNotifier { |
class NET_EXPORT MaxBandwidthObserver { |
public: |
- // Will be called when a change occurs to the network's maximum bandwidth as |
- // defined in http://w3c.github.io/netinfo/. Generally this will only be |
- // called on bandwidth changing network connection/disconnection events. |
- // Some platforms may call it more frequently, such as when WiFi signal |
- // strength changes. |
- // TODO(jkarlin): This is currently only implemented for Android. Implement |
- // on every platform. |
- virtual void OnMaxBandwidthChanged(double max_bandwidth_mbps) = 0; |
+ // Called when a change occurs to the network's maximum bandwidth as |
+ // defined in http://w3c.github.io/netinfo/. Also called on type change, |
+ // even if the maximum bandwidth doesn't change. See the documentation of |
+ // GetMaxBanwidth for what to expect for the values of |max_bandwidth_mbps|. |
+ virtual void OnMaxBandwidthChanged(ConnectionType type, |
+ double max_bandwidth_mbps) = 0; |
protected: |
MaxBandwidthObserver() {} |
@@ -235,11 +233,12 @@ class NET_EXPORT NetworkChangeNotifier { |
static ConnectionType GetConnectionType(); |
// Returns a theoretical upper limit on download bandwidth, potentially based |
- // on underlying connection type, signal strength, or some other signal. The |
- // default mapping of connection type to maximum bandwidth is provided in the |
- // NetInfo spec: http://w3c.github.io/netinfo/. Host-specific application |
- // permissions may be required, please see host-specific declaration for more |
- // information. |
+ // on underlying connection type, signal strength, or some other signal. |
+ // Specifically, it returns +Infinity if there is a connection and |
+ // 0.0 otherwise. The circumstances in which a more specific value is given |
+ // are: Android cellular types, Android wifi types, and ChromeOS cellular |
+ // types). See the NetInfo spec for the mapping of specific subtypes to |
pneubeck (no reviews)
2015/09/11 07:48:20
s/)//
jkarlin
2015/09/11 18:56:11
Done.
|
+ // bandwidth values: http://w3c.github.io/netinfo/. |
static double GetMaxBandwidth(); |
// Retrieve the last read DnsConfig. This could be expensive if the system has |
@@ -309,6 +308,8 @@ class NET_EXPORT NetworkChangeNotifier { |
ConnectionType type); |
static void NotifyObserversOfNetworkChangeForTests(ConnectionType type); |
static void NotifyObserversOfInitialDNSConfigReadForTests(); |
+ static void NotifyObserversOfMaxBandwidthChangeForTests(ConnectionType type, |
+ double max_bandwidth); |
// Enable or disable notifications from the host. After setting to true, be |
// sure to pump the RunLoop until idle to finish any preexisting |
@@ -407,7 +408,8 @@ class NET_EXPORT NetworkChangeNotifier { |
static void NotifyObserversOfDNSChange(); |
static void NotifyObserversOfInitialDNSConfigRead(); |
static void NotifyObserversOfNetworkChange(ConnectionType type); |
- static void NotifyObserversOfMaxBandwidthChange(double max_bandwidth_mbps); |
+ static void NotifyObserversOfMaxBandwidthChange(ConnectionType type, |
+ double max_bandwidth_mbps); |
// Stores |config| in NetworkState and notifies OnDNSChanged observers. |
static void SetDnsConfig(const DnsConfig& config); |
@@ -429,7 +431,8 @@ class NET_EXPORT NetworkChangeNotifier { |
void NotifyObserversOfDNSChangeImpl(); |
void NotifyObserversOfInitialDNSConfigReadImpl(); |
void NotifyObserversOfNetworkChangeImpl(ConnectionType type); |
- void NotifyObserversOfMaxBandwidthChangeImpl(double max_bandwidth_mbps); |
+ void NotifyObserversOfMaxBandwidthChangeImpl(ConnectionType type, |
+ double max_bandwidth_mbps); |
const scoped_refptr<base::ObserverListThreadSafe<IPAddressObserver>> |
ip_address_observer_list_; |