Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Side by Side Diff: net/base/network_change_notifier.h

Issue 298803006: NetInfo V3 support for browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comment in network_change_notifier Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
39 // Also used as a default value.
39 CONNECTION_ETHERNET = 1, 40 CONNECTION_ETHERNET = 1,
Tom Sepez 2014/05/28 17:40:16 nit: maybe CONNECTION_FIRST = CONNECTION_UNKNOWN h
jkarlin 2014/05/28 18:00:46 Went with MAX_VALUE instead, thanks!
40 CONNECTION_WIFI = 2, 41 CONNECTION_WIFI = 2,
41 CONNECTION_2G = 3, 42 CONNECTION_2G = 3,
42 CONNECTION_3G = 4, 43 CONNECTION_3G = 4,
43 CONNECTION_4G = 5, 44 CONNECTION_4G = 5,
44 CONNECTION_NONE = 6 // No connection. 45 CONNECTION_NONE = 6, // No connection.
46 CONNECTION_LAST = CONNECTION_NONE
45 }; 47 };
46 48
47 class NET_EXPORT IPAddressObserver { 49 class NET_EXPORT IPAddressObserver {
48 public: 50 public:
49 // Will be called when the IP address of the primary interface changes. 51 // Will be called when the IP address of the primary interface changes.
50 // This includes when the primary interface itself changes. 52 // This includes when the primary interface itself changes.
51 virtual void OnIPAddressChanged() = 0; 53 virtual void OnIPAddressChanged() = 0;
52 54
53 protected: 55 protected:
54 IPAddressObserver() {} 56 IPAddressObserver() {}
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 325
324 // Computes NetworkChange signal from IPAddress and ConnectionType signals. 326 // Computes NetworkChange signal from IPAddress and ConnectionType signals.
325 scoped_ptr<NetworkChangeCalculator> network_change_calculator_; 327 scoped_ptr<NetworkChangeCalculator> network_change_calculator_;
326 328
327 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 329 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
328 }; 330 };
329 331
330 } // namespace net 332 } // namespace net
331 333
332 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 334 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698