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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 // Returns the device's current default network connection. This is the | 321 // Returns the device's current default network connection. This is the |
| 322 // network used for newly created socket communication for sockets that are | 322 // network used for newly created socket communication for sockets that are |
| 323 // not explicitly bound to a particular network (e.g. via | 323 // not explicitly bound to a particular network (e.g. via |
| 324 // DatagramClientSocket.BindToNetwork). Returns |kInvalidNetworkHandle| if | 324 // DatagramClientSocket.BindToNetwork). Returns |kInvalidNetworkHandle| if |
| 325 // there is no default connected network. | 325 // there is no default connected network. |
| 326 // Only implemented for Android (Lollipop and newer), returns | 326 // Only implemented for Android (Lollipop and newer), returns |
| 327 // |kInvalidNetworkHandle| when unimplemented. | 327 // |kInvalidNetworkHandle| when unimplemented. |
| 328 // Requires NetworkHandles support, see AreNetworkHandlesSupported(). | 328 // Requires NetworkHandles support, see AreNetworkHandlesSupported(). |
| 329 static NetworkHandle GetDefaultNetwork(); | 329 static NetworkHandle GetDefaultNetwork(); |
| 330 | 330 |
| 331 // Returns true if the captive portal probe was blocked for the current | |
|
pauljensen
2016/11/16 16:10:23
"the captive portal probe was blocked for"->"the s
| |
| 332 // network. May incorrectly return true if the user has signed into the | |
|
pauljensen
2016/11/16 16:10:24
network->default network
| |
| 333 // captive portal since the network was last probed. Only available on | |
| 334 // Lollipop and newer releases. | |
|
pauljensen
2016/11/16 16:10:23
Lollipop->Marshmallow
pauljensen
2016/11/16 16:10:24
Mention it's only available on Android
pauljensen
2016/11/16 16:10:24
Mention what is returned if unavailable
| |
| 335 static bool GetNetworkCaptivePortal(); | |
| 336 | |
| 331 // Retrieve the last read DnsConfig. This could be expensive if the system has | 337 // Retrieve the last read DnsConfig. This could be expensive if the system has |
| 332 // a large HOSTS file. | 338 // a large HOSTS file. |
| 333 static void GetDnsConfig(DnsConfig* config); | 339 static void GetDnsConfig(DnsConfig* config); |
| 334 | 340 |
| 335 #if defined(OS_LINUX) | 341 #if defined(OS_LINUX) |
| 336 // Returns the AddressTrackerLinux if present. | 342 // Returns the AddressTrackerLinux if present. |
| 337 static const internal::AddressTrackerLinux* GetAddressTracker(); | 343 static const internal::AddressTrackerLinux* GetAddressTracker(); |
| 338 #endif | 344 #endif |
| 339 | 345 |
| 340 // Convenience method to determine if the user is offline. | 346 // Convenience method to determine if the user is offline. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 // cheap as they are called often. | 507 // cheap as they are called often. |
| 502 virtual ConnectionType GetCurrentConnectionType() const = 0; | 508 virtual ConnectionType GetCurrentConnectionType() const = 0; |
| 503 virtual void GetCurrentMaxBandwidthAndConnectionType( | 509 virtual void GetCurrentMaxBandwidthAndConnectionType( |
| 504 double* max_bandwidth_mbps, | 510 double* max_bandwidth_mbps, |
| 505 ConnectionType* connection_type) const; | 511 ConnectionType* connection_type) const; |
| 506 virtual bool AreNetworkHandlesCurrentlySupported() const; | 512 virtual bool AreNetworkHandlesCurrentlySupported() const; |
| 507 virtual void GetCurrentConnectedNetworks(NetworkList* network_list) const; | 513 virtual void GetCurrentConnectedNetworks(NetworkList* network_list) const; |
| 508 virtual ConnectionType GetCurrentNetworkConnectionType( | 514 virtual ConnectionType GetCurrentNetworkConnectionType( |
| 509 NetworkHandle network) const; | 515 NetworkHandle network) const; |
| 510 virtual NetworkHandle GetCurrentDefaultNetwork() const; | 516 virtual NetworkHandle GetCurrentDefaultNetwork() const; |
| 517 virtual bool GetCurrentNetworkCaptivePortal() const; | |
| 511 | 518 |
| 512 // Hook that allows derived implementations to log histograms at the time a | 519 // Hook that allows derived implementations to log histograms at the time a |
| 513 // new histogram record is being finalized. | 520 // new histogram record is being finalized. |
| 514 virtual void OnFinalizingMetricsLogRecord() {} | 521 virtual void OnFinalizingMetricsLogRecord() {} |
| 515 | 522 |
| 516 // Broadcasts a notification to all registered observers. Note that this | 523 // Broadcasts a notification to all registered observers. Note that this |
| 517 // happens asynchronously, even for observers on the current thread, even in | 524 // happens asynchronously, even for observers on the current thread, even in |
| 518 // tests. | 525 // tests. |
| 519 static void NotifyObserversOfIPAddressChange(); | 526 static void NotifyObserversOfIPAddressChange(); |
| 520 static void NotifyObserversOfConnectionTypeChange(); | 527 static void NotifyObserversOfConnectionTypeChange(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 | 582 |
| 576 // Set true to disable non-test notifications (to prevent flakes in tests). | 583 // Set true to disable non-test notifications (to prevent flakes in tests). |
| 577 static bool test_notifications_only_; | 584 static bool test_notifications_only_; |
| 578 | 585 |
| 579 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 586 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
| 580 }; | 587 }; |
| 581 | 588 |
| 582 } // namespace net | 589 } // namespace net |
| 583 | 590 |
| 584 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 591 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| OLD | NEW |