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> |
| 11 #include <string> | |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/observer_list_threadsafe.h" | 15 #include "base/observer_list_threadsafe.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
| 17 | 18 |
| 18 class GURL; | 19 class GURL; |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 // 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 |
| 269 // 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; |
| 270 // 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 |
| 271 // attempt to a particular remote site will be successful. | 272 // attempt to a particular remote site will be successful. |
| 272 // The returned value only describes the connection currently used by the | 273 // The returned value only describes the connection currently used by the |
| 273 // 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 |
| 274 // 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 |
| 275 // the internet, the connection type is CONNECTION_WIFI. | 276 // the internet, the connection type is CONNECTION_WIFI. |
| 276 static ConnectionType GetConnectionType(); | 277 static ConnectionType GetConnectionType(); |
| 277 | 278 |
| 279 // Returns the SSID of the current connection. If the current connection type | |
| 280 // is not CONNECTION_WIFI, or if the SSID is unavailable, it may return an | |
|
Not at Google. Contact bengr
2016/06/23 20:08:56
"may" -> "will"?
tbansal1
2016/06/27 19:48:20
Done.
| |
| 281 // empty string. Currently, only implemented on Android. | |
| 282 static std::string GetWiFiSSID(); | |
| 283 | |
| 278 // Sets |max_bandwidth_mbps| to a theoretical upper limit on download | 284 // Sets |max_bandwidth_mbps| to a theoretical upper limit on download |
| 279 // bandwidth, potentially based on underlying connection type, signal | 285 // bandwidth, potentially based on underlying connection type, signal |
| 280 // strength, or some other signal. If the network subtype is unknown then | 286 // strength, or some other signal. If the network subtype is unknown then |
| 281 // |max_bandwidth_mbps| is set to +Infinity and if there is no network | 287 // |max_bandwidth_mbps| is set to +Infinity and if there is no network |
| 282 // connection then it is set to 0.0. The circumstances in which a more | 288 // connection then it is set to 0.0. The circumstances in which a more |
| 283 // specific value is given are: when an Android device is connected to a | 289 // specific value is given are: when an Android device is connected to a |
| 284 // cellular or WiFi network, and when a ChromeOS device is connected to a | 290 // cellular or WiFi network, and when a ChromeOS device is connected to a |
| 285 // cellular network. See the NetInfo spec for the mapping of | 291 // cellular network. See the NetInfo spec for the mapping of |
| 286 // specific subtypes to bandwidth values: http://w3c.github.io/netinfo/. | 292 // specific subtypes to bandwidth values: http://w3c.github.io/netinfo/. |
| 287 // |connection_type| is set to the current active default network's connection | 293 // |connection_type| is set to the current active default network's connection |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 #endif | 499 #endif |
| 494 | 500 |
| 495 // These are the actual implementations of the static queryable APIs. | 501 // These are the actual implementations of the static queryable APIs. |
| 496 // See the description of the corresponding functions named without "Current". | 502 // See the description of the corresponding functions named without "Current". |
| 497 // Implementations must be thread-safe. Implementations must also be | 503 // Implementations must be thread-safe. Implementations must also be |
| 498 // cheap as they are called often. | 504 // cheap as they are called often. |
| 499 virtual ConnectionType GetCurrentConnectionType() const = 0; | 505 virtual ConnectionType GetCurrentConnectionType() const = 0; |
| 500 virtual void GetCurrentMaxBandwidthAndConnectionType( | 506 virtual void GetCurrentMaxBandwidthAndConnectionType( |
| 501 double* max_bandwidth_mbps, | 507 double* max_bandwidth_mbps, |
| 502 ConnectionType* connection_type) const; | 508 ConnectionType* connection_type) const; |
| 509 virtual std::string GetCurrentWiFiSSID() const; | |
| 503 virtual bool AreNetworkHandlesCurrentlySupported() const; | 510 virtual bool AreNetworkHandlesCurrentlySupported() const; |
| 504 virtual void GetCurrentConnectedNetworks(NetworkList* network_list) const; | 511 virtual void GetCurrentConnectedNetworks(NetworkList* network_list) const; |
| 505 virtual ConnectionType GetCurrentNetworkConnectionType( | 512 virtual ConnectionType GetCurrentNetworkConnectionType( |
| 506 NetworkHandle network) const; | 513 NetworkHandle network) const; |
| 507 virtual NetworkHandle GetCurrentDefaultNetwork() const; | 514 virtual NetworkHandle GetCurrentDefaultNetwork() const; |
| 508 | 515 |
| 509 // Hook that allows derived implementations to log histograms at the time a | 516 // Hook that allows derived implementations to log histograms at the time a |
| 510 // new histogram record is being finalized. | 517 // new histogram record is being finalized. |
| 511 virtual void OnFinalizingMetricsLogRecord() {} | 518 virtual void OnFinalizingMetricsLogRecord() {} |
| 512 | 519 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 | 579 |
| 573 // Set true to disable non-test notifications (to prevent flakes in tests). | 580 // Set true to disable non-test notifications (to prevent flakes in tests). |
| 574 static bool test_notifications_only_; | 581 static bool test_notifications_only_; |
| 575 | 582 |
| 576 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 583 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
| 577 }; | 584 }; |
| 578 | 585 |
| 579 } // namespace net | 586 } // namespace net |
| 580 | 587 |
| 581 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 588 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| OLD | NEW |