Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 // user won't be able to connect to remote sites. However, another return | 269 // user won't be able to connect to remote sites. However, another return |
| 270 // value doesn't imply that the user will be able to connect to remote sites; | 270 // value doesn't imply that the user will be able to connect to remote sites; |
| 271 // even if some link is up, it is uncertain whether a particular connection | 271 // even if some link is up, it is uncertain whether a particular connection |
| 272 // attempt to a particular remote site will be successful. | 272 // attempt to a particular remote site will be successful. |
| 273 // The returned value only describes the connection currently used by the | 273 // The returned value only describes the connection currently used by the |
| 274 // device, and does not take into account other machines on the network. For | 274 // device, and does not take into account other machines on the network. For |
| 275 // example, if the device is connected using Wifi to a 3G gateway to access | 275 // example, if the device is connected using Wifi to a 3G gateway to access |
| 276 // the internet, the connection type is CONNECTION_WIFI. | 276 // the internet, the connection type is CONNECTION_WIFI. |
| 277 static ConnectionType GetConnectionType(); | 277 static ConnectionType GetConnectionType(); |
| 278 | 278 |
| 279 // Returns the connection subtype of the network the client is connected to. | |
|
pauljensen
2017/03/24 18:38:58
"the connection subtype of the network the client
tbansal1
2017/03/24 23:22:24
Done.
| |
| 280 // The returned value only describes the connection currently used by the | |
| 281 // device, and does not take into account other machines on the network. For | |
| 282 // example, if the device is connected using Wifi to a 3G gateway to access | |
| 283 // the internet, the connection type is CONNECTION_WIFI. | |
|
pauljensen
2017/03/24 18:38:58
there is no sub-type for WiFi
pauljensen
2017/03/24 18:38:59
The returned value only describes the connection c
tbansal1
2017/03/24 23:22:24
Thanks, I am more interested in cellular. If it pr
tbansal1
2017/03/24 23:22:24
Done.
| |
| 284 static ConnectionSubtype GetConnectionSubtype(); | |
| 285 | |
| 279 // Sets |max_bandwidth_mbps| to a theoretical upper limit on download | 286 // Sets |max_bandwidth_mbps| to a theoretical upper limit on download |
| 280 // bandwidth, potentially based on underlying connection type, signal | 287 // bandwidth, potentially based on underlying connection type, signal |
| 281 // strength, or some other signal. If the network subtype is unknown then | 288 // strength, or some other signal. If the network subtype is unknown then |
| 282 // |max_bandwidth_mbps| is set to +Infinity and if there is no network | 289 // |max_bandwidth_mbps| is set to +Infinity and if there is no network |
| 283 // connection then it is set to 0.0. The circumstances in which a more | 290 // connection then it is set to 0.0. The circumstances in which a more |
| 284 // specific value is given are: when an Android device is connected to a | 291 // specific value is given are: when an Android device is connected to a |
| 285 // cellular or WiFi network, and when a ChromeOS device is connected to a | 292 // cellular or WiFi network, and when a ChromeOS device is connected to a |
| 286 // cellular network. See the NetInfo spec for the mapping of | 293 // cellular network. See the NetInfo spec for the mapping of |
| 287 // specific subtypes to bandwidth values: http://w3c.github.io/netinfo/. | 294 // specific subtypes to bandwidth values: http://w3c.github.io/netinfo/. |
| 288 // |connection_type| is set to the current active default network's connection | 295 // |connection_type| is set to the current active default network's connection |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 // TODO(szym): Retrieve AddressMap from NetworkState. http://crbug.com/144212 | 498 // TODO(szym): Retrieve AddressMap from NetworkState. http://crbug.com/144212 |
| 492 virtual const internal::AddressTrackerLinux* | 499 virtual const internal::AddressTrackerLinux* |
| 493 GetAddressTrackerInternal() const; | 500 GetAddressTrackerInternal() const; |
| 494 #endif | 501 #endif |
| 495 | 502 |
| 496 // These are the actual implementations of the static queryable APIs. | 503 // These are the actual implementations of the static queryable APIs. |
| 497 // See the description of the corresponding functions named without "Current". | 504 // See the description of the corresponding functions named without "Current". |
| 498 // Implementations must be thread-safe. Implementations must also be | 505 // Implementations must be thread-safe. Implementations must also be |
| 499 // cheap as they are called often. | 506 // cheap as they are called often. |
| 500 virtual ConnectionType GetCurrentConnectionType() const = 0; | 507 virtual ConnectionType GetCurrentConnectionType() const = 0; |
| 508 virtual ConnectionSubtype GetCurrentConnectionSubtype() const; | |
| 501 virtual void GetCurrentMaxBandwidthAndConnectionType( | 509 virtual void GetCurrentMaxBandwidthAndConnectionType( |
| 502 double* max_bandwidth_mbps, | 510 double* max_bandwidth_mbps, |
| 503 ConnectionType* connection_type) const; | 511 ConnectionType* connection_type) const; |
| 504 virtual bool AreNetworkHandlesCurrentlySupported() const; | 512 virtual bool AreNetworkHandlesCurrentlySupported() const; |
| 505 virtual void GetCurrentConnectedNetworks(NetworkList* network_list) const; | 513 virtual void GetCurrentConnectedNetworks(NetworkList* network_list) const; |
| 506 virtual ConnectionType GetCurrentNetworkConnectionType( | 514 virtual ConnectionType GetCurrentNetworkConnectionType( |
| 507 NetworkHandle network) const; | 515 NetworkHandle network) const; |
| 508 virtual NetworkHandle GetCurrentDefaultNetwork() const; | 516 virtual NetworkHandle GetCurrentDefaultNetwork() const; |
| 509 | 517 |
| 510 // Hook that allows derived implementations to log histograms at the time a | 518 // Hook that allows derived implementations to log histograms at the time a |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 | 581 |
| 574 // Set true to disable non-test notifications (to prevent flakes in tests). | 582 // Set true to disable non-test notifications (to prevent flakes in tests). |
| 575 static bool test_notifications_only_; | 583 static bool test_notifications_only_; |
| 576 | 584 |
| 577 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 585 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
| 578 }; | 586 }; |
| 579 | 587 |
| 580 } // namespace net | 588 } // namespace net |
| 581 | 589 |
| 582 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 590 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| OLD | NEW |