| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // called back with notifications. This is safe to call if Create() has not | 354 // called back with notifications. This is safe to call if Create() has not |
| 355 // been called (as long as it doesn't race the Create() call on another | 355 // been called (as long as it doesn't race the Create() call on another |
| 356 // thread), in which case it will simply do nothing. | 356 // thread), in which case it will simply do nothing. |
| 357 static void AddIPAddressObserver(IPAddressObserver* observer); | 357 static void AddIPAddressObserver(IPAddressObserver* observer); |
| 358 static void AddConnectionTypeObserver(ConnectionTypeObserver* observer); | 358 static void AddConnectionTypeObserver(ConnectionTypeObserver* observer); |
| 359 static void AddDNSObserver(DNSObserver* observer); | 359 static void AddDNSObserver(DNSObserver* observer); |
| 360 static void AddNetworkChangeObserver(NetworkChangeObserver* observer); | 360 static void AddNetworkChangeObserver(NetworkChangeObserver* observer); |
| 361 static void AddMaxBandwidthObserver(MaxBandwidthObserver* observer); | 361 static void AddMaxBandwidthObserver(MaxBandwidthObserver* observer); |
| 362 static void AddNetworkObserver(NetworkObserver* observer); | 362 static void AddNetworkObserver(NetworkObserver* observer); |
| 363 | 363 |
| 364 // Returns true if platform supports notifications required for observer. |
| 365 static bool IsNetworkObserverSupported(); |
| 366 |
| 364 // Unregisters |observer| from receiving notifications. This must be called | 367 // Unregisters |observer| from receiving notifications. This must be called |
| 365 // on the same thread on which AddObserver() was called. Like AddObserver(), | 368 // on the same thread on which AddObserver() was called. Like AddObserver(), |
| 366 // this is safe to call if Create() has not been called (as long as it doesn't | 369 // this is safe to call if Create() has not been called (as long as it doesn't |
| 367 // race the Create() call on another thread), in which case it will simply do | 370 // race the Create() call on another thread), in which case it will simply do |
| 368 // nothing. Technically, it's also safe to call after the notifier object has | 371 // nothing. Technically, it's also safe to call after the notifier object has |
| 369 // been destroyed, if the call doesn't race the notifier's destruction, but | 372 // been destroyed, if the call doesn't race the notifier's destruction, but |
| 370 // there's no reason to use the API in this risky way, so don't do it. | 373 // there's no reason to use the API in this risky way, so don't do it. |
| 371 static void RemoveIPAddressObserver(IPAddressObserver* observer); | 374 static void RemoveIPAddressObserver(IPAddressObserver* observer); |
| 372 static void RemoveConnectionTypeObserver(ConnectionTypeObserver* observer); | 375 static void RemoveConnectionTypeObserver(ConnectionTypeObserver* observer); |
| 373 static void RemoveDNSObserver(DNSObserver* observer); | 376 static void RemoveDNSObserver(DNSObserver* observer); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 551 |
| 549 // Set true to disable non-test notifications (to prevent flakes in tests). | 552 // Set true to disable non-test notifications (to prevent flakes in tests). |
| 550 static bool test_notifications_only_; | 553 static bool test_notifications_only_; |
| 551 | 554 |
| 552 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 555 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
| 553 }; | 556 }; |
| 554 | 557 |
| 555 } // namespace net | 558 } // namespace net |
| 556 | 559 |
| 557 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 560 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| OLD | NEW |