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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/observer_list_threadsafe.h" | 9 #include "base/observer_list_threadsafe.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #endif | 26 #endif |
27 | 27 |
28 // NetworkChangeNotifier monitors the system for network changes, and notifies | 28 // NetworkChangeNotifier monitors the system for network changes, and notifies |
29 // registered observers of those events. Observers may register on any thread, | 29 // registered observers of those events. Observers may register on any thread, |
30 // and will be called back on the thread from which they registered. | 30 // and will be called back on the thread from which they registered. |
31 // NetworkChangeNotifiers are threadsafe, though they must be created and | 31 // NetworkChangeNotifiers are threadsafe, though they must be created and |
32 // destroyed on the same thread. | 32 // destroyed on the same thread. |
33 class NET_EXPORT NetworkChangeNotifier { | 33 class NET_EXPORT NetworkChangeNotifier { |
34 public: | 34 public: |
35 // Using the terminology of the Network Information API: | 35 // Using the terminology of the Network Information API: |
36 // http://www.w3.org/TR/netinfo-api. | 36 // http://www.w3.org/TR/netinfo-api. |
pauljensen
2014/05/30 11:43:11
This is no longer accurate with your change. Mayb
jkarlin
2014/05/30 11:53:14
Done.
| |
37 enum ConnectionType { | 37 enum ConnectionType { |
38 CONNECTION_UNKNOWN = 0, // A connection exists, but its type is unknown. | 38 CONNECTION_UNKNOWN = 0, // A connection exists, but its type is unknown. |
39 // Also used as a default value. | 39 // Also used as a default value. |
40 CONNECTION_ETHERNET = 1, | 40 CONNECTION_ETHERNET = 1, |
41 CONNECTION_WIFI = 2, | 41 CONNECTION_WIFI = 2, |
42 CONNECTION_2G = 3, | 42 CONNECTION_2G = 3, |
43 CONNECTION_3G = 4, | 43 CONNECTION_3G = 4, |
44 CONNECTION_4G = 5, | 44 CONNECTION_4G = 5, |
45 CONNECTION_NONE = 6, // No connection. | 45 CONNECTION_NONE = 6, // No connection. |
46 CONNECTION_LAST = CONNECTION_NONE | 46 CONNECTION_BLUETOOTH = 7, |
47 CONNECTION_LAST = CONNECTION_BLUETOOTH | |
47 }; | 48 }; |
48 | 49 |
49 class NET_EXPORT IPAddressObserver { | 50 class NET_EXPORT IPAddressObserver { |
50 public: | 51 public: |
51 // Will be called when the IP address of the primary interface changes. | 52 // Will be called when the IP address of the primary interface changes. |
52 // This includes when the primary interface itself changes. | 53 // This includes when the primary interface itself changes. |
53 virtual void OnIPAddressChanged() = 0; | 54 virtual void OnIPAddressChanged() = 0; |
54 | 55 |
55 protected: | 56 protected: |
56 IPAddressObserver() {} | 57 IPAddressObserver() {} |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 | 326 |
326 // Computes NetworkChange signal from IPAddress and ConnectionType signals. | 327 // Computes NetworkChange signal from IPAddress and ConnectionType signals. |
327 scoped_ptr<NetworkChangeCalculator> network_change_calculator_; | 328 scoped_ptr<NetworkChangeCalculator> network_change_calculator_; |
328 | 329 |
329 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 330 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
330 }; | 331 }; |
331 | 332 |
332 } // namespace net | 333 } // namespace net |
333 | 334 |
334 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 335 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
OLD | NEW |