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 17 matching lines...) Expand all Loading... | |
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. |
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. |
brettw
2014/05/27 18:26:36
It seems like this comment is wrong given that the
jkarlin
2014/05/27 18:44:37
I think you're right. Updated the comment.
| |
39 CONNECTION_ETHERNET = 1, | 39 CONNECTION_ETHERNET = 1, |
40 CONNECTION_WIFI = 2, | 40 CONNECTION_WIFI = 2, |
41 CONNECTION_2G = 3, | 41 CONNECTION_2G = 3, |
42 CONNECTION_3G = 4, | 42 CONNECTION_3G = 4, |
43 CONNECTION_4G = 5, | 43 CONNECTION_4G = 5, |
44 CONNECTION_NONE = 6 // No connection. | 44 CONNECTION_NONE = 6, // No connection. |
45 CONNECTION_LAST = CONNECTION_NONE | |
45 }; | 46 }; |
46 | 47 |
47 class NET_EXPORT IPAddressObserver { | 48 class NET_EXPORT IPAddressObserver { |
48 public: | 49 public: |
49 // Will be called when the IP address of the primary interface changes. | 50 // Will be called when the IP address of the primary interface changes. |
50 // This includes when the primary interface itself changes. | 51 // This includes when the primary interface itself changes. |
51 virtual void OnIPAddressChanged() = 0; | 52 virtual void OnIPAddressChanged() = 0; |
52 | 53 |
53 protected: | 54 protected: |
54 IPAddressObserver() {} | 55 IPAddressObserver() {} |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 | 324 |
324 // Computes NetworkChange signal from IPAddress and ConnectionType signals. | 325 // Computes NetworkChange signal from IPAddress and ConnectionType signals. |
325 scoped_ptr<NetworkChangeCalculator> network_change_calculator_; | 326 scoped_ptr<NetworkChangeCalculator> network_change_calculator_; |
326 | 327 |
327 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 328 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
328 }; | 329 }; |
329 | 330 |
330 } // namespace net | 331 } // namespace net |
331 | 332 |
332 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 333 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
OLD | NEW |