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

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

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "base/observer_list_threadsafe.h" 11 #include "base/observer_list_threadsafe.h"
10 #include "base/time/time.h" 12 #include "base/time/time.h"
11 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
12 14
13 class GURL; 15 class GURL;
14 16
15 namespace net { 17 namespace net {
16 18
17 struct DnsConfig; 19 struct DnsConfig;
18 class HistogramWatcher; 20 class HistogramWatcher;
19 class NetworkChangeNotifierFactory; 21 class NetworkChangeNotifierFactory;
22 struct NetworkInterface;
23 typedef std::vector<NetworkInterface> NetworkInterfaceList;
20 class URLRequest; 24 class URLRequest;
21 25
22 #if defined(OS_LINUX) 26 #if defined(OS_LINUX)
23 namespace internal { 27 namespace internal {
24 class AddressTrackerLinux; 28 class AddressTrackerLinux;
25 } 29 }
26 #endif 30 #endif
27 31
28 // NetworkChangeNotifier monitors the system for network changes, and notifies 32 // NetworkChangeNotifier monitors the system for network changes, and notifies
29 // registered observers of those events. Observers may register on any thread, 33 // registered observers of those events. Observers may register on any thread,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // will be successfully. 255 // will be successfully.
252 static bool IsOffline(); 256 static bool IsOffline();
253 257
254 // Returns true if |type| is a cellular connection. 258 // Returns true if |type| is a cellular connection.
255 // Returns false if |type| is CONNECTION_UNKNOWN, and thus, depending on the 259 // Returns false if |type| is CONNECTION_UNKNOWN, and thus, depending on the
256 // implementation of GetConnectionType(), it is possible that 260 // implementation of GetConnectionType(), it is possible that
257 // IsConnectionCellular(GetConnectionType()) returns false even if the 261 // IsConnectionCellular(GetConnectionType()) returns false even if the
258 // current connection is cellular. 262 // current connection is cellular.
259 static bool IsConnectionCellular(ConnectionType type); 263 static bool IsConnectionCellular(ConnectionType type);
260 264
265 // Gets the current connection type based on |interfaces|. Returns
266 // CONNECTION_NONE if there are no interfaces, CONNECTION_UNKNOWN if two
267 // interfaces have different connection types or the connection type of all
268 // interfaces if they have the same interface type.
269 static ConnectionType ConnectionTypeFromInterfaceList(
270 const NetworkInterfaceList& interfaces);
271
261 // Like Create(), but for use in tests. The mock object doesn't monitor any 272 // Like Create(), but for use in tests. The mock object doesn't monitor any
262 // events, it merely rebroadcasts notifications when requested. 273 // events, it merely rebroadcasts notifications when requested.
263 static NetworkChangeNotifier* CreateMock(); 274 static NetworkChangeNotifier* CreateMock();
264 275
265 // Registers |observer| to receive notifications of network changes. The 276 // Registers |observer| to receive notifications of network changes. The
266 // thread on which this is called is the thread on which |observer| will be 277 // thread on which this is called is the thread on which |observer| will be
267 // called back with notifications. This is safe to call if Create() has not 278 // called back with notifications. This is safe to call if Create() has not
268 // been called (as long as it doesn't race the Create() call on another 279 // been called (as long as it doesn't race the Create() call on another
269 // thread), in which case it will simply do nothing. 280 // thread), in which case it will simply do nothing.
270 static void AddIPAddressObserver(IPAddressObserver* observer); 281 static void AddIPAddressObserver(IPAddressObserver* observer);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 440
430 // Set true to disable non-test notifications (to prevent flakes in tests). 441 // Set true to disable non-test notifications (to prevent flakes in tests).
431 bool test_notifications_only_; 442 bool test_notifications_only_;
432 443
433 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 444 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
434 }; 445 };
435 446
436 } // namespace net 447 } // namespace net
437 448
438 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 449 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698