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

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

Issue 1306423004: [NetInfo] Browser changes to support connection.downlinkMax (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up Created 5 years, 3 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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // the internet, the connection type is CONNECTION_WIFI. 235 // the internet, the connection type is CONNECTION_WIFI.
236 static ConnectionType GetConnectionType(); 236 static ConnectionType GetConnectionType();
237 237
238 // Returns a theoretical upper limit on download bandwidth, potentially based 238 // Returns a theoretical upper limit on download bandwidth, potentially based
239 // on underlying connection type, signal strength, or some other signal. The 239 // on underlying connection type, signal strength, or some other signal. The
240 // default mapping of connection type to maximum bandwidth is provided in the 240 // default mapping of connection type to maximum bandwidth is provided in the
241 // NetInfo spec: http://w3c.github.io/netinfo/. See documentation in the 241 // NetInfo spec: http://w3c.github.io/netinfo/. See documentation in the
242 // MaxBandwidthChangedObserver for more information on what values to expect. 242 // MaxBandwidthChangedObserver for more information on what values to expect.
243 static double GetMaxBandwidth(); 243 static double GetMaxBandwidth();
244 244
245 // Returns a theoretical upper limit on download bandwidth given a connection
246 // subtype. The mapping of connection type to maximum bandwidth is provided in
247 // the NetInfo spec: http://w3c.github.io/netinfo/.
pauljensen 2015/09/11 14:25:37 Comment doesn't mention units, neither does functi
jkarlin 2015/09/11 20:15:21 Done.
248 static double GetMaxBandwidthForConnectionSubtype(ConnectionSubtype subtype);
249
245 // Retrieve the last read DnsConfig. This could be expensive if the system has 250 // Retrieve the last read DnsConfig. This could be expensive if the system has
246 // a large HOSTS file. 251 // a large HOSTS file.
247 static void GetDnsConfig(DnsConfig* config); 252 static void GetDnsConfig(DnsConfig* config);
248 253
249 #if defined(OS_LINUX) 254 #if defined(OS_LINUX)
250 // Returns the AddressTrackerLinux if present. 255 // Returns the AddressTrackerLinux if present.
251 static const internal::AddressTrackerLinux* GetAddressTracker(); 256 static const internal::AddressTrackerLinux* GetAddressTracker();
252 #endif 257 #endif
253 258
254 // Convenience method to determine if the user is offline. 259 // Convenience method to determine if the user is offline.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // TODO(szym): Retrieve AddressMap from NetworkState. http://crbug.com/144212 394 // TODO(szym): Retrieve AddressMap from NetworkState. http://crbug.com/144212
390 virtual const internal::AddressTrackerLinux* 395 virtual const internal::AddressTrackerLinux*
391 GetAddressTrackerInternal() const; 396 GetAddressTrackerInternal() const;
392 #endif 397 #endif
393 398
394 // See the description of NetworkChangeNotifier::GetMaxBandwidth(). 399 // See the description of NetworkChangeNotifier::GetMaxBandwidth().
395 // Implementations must be thread-safe. Implementations must also be 400 // Implementations must be thread-safe. Implementations must also be
396 // cheap as it is called often. 401 // cheap as it is called often.
397 virtual double GetCurrentMaxBandwidth() const; 402 virtual double GetCurrentMaxBandwidth() const;
398 403
399 // Returns a theoretical upper limit on download bandwidth given a connection
400 // subtype. The mapping of connection type to maximum bandwidth is provided in
401 // the NetInfo spec: http://w3c.github.io/netinfo/.
402 static double GetMaxBandwidthForConnectionSubtype(ConnectionSubtype subtype);
403
404 // Broadcasts a notification to all registered observers. Note that this 404 // Broadcasts a notification to all registered observers. Note that this
405 // happens asynchronously, even for observers on the current thread, even in 405 // happens asynchronously, even for observers on the current thread, even in
406 // tests. 406 // tests.
407 static void NotifyObserversOfIPAddressChange(); 407 static void NotifyObserversOfIPAddressChange();
408 static void NotifyObserversOfConnectionTypeChange(); 408 static void NotifyObserversOfConnectionTypeChange();
409 static void NotifyObserversOfDNSChange(); 409 static void NotifyObserversOfDNSChange();
410 static void NotifyObserversOfInitialDNSConfigRead(); 410 static void NotifyObserversOfInitialDNSConfigRead();
411 static void NotifyObserversOfNetworkChange(ConnectionType type); 411 static void NotifyObserversOfNetworkChange(ConnectionType type);
412 static void NotifyObserversOfMaxBandwidthChange(ConnectionType type, 412 static void NotifyObserversOfMaxBandwidthChange(ConnectionType type,
413 double max_bandwidth_mbps); 413 double max_bandwidth_mbps);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 457
458 // Set true to disable non-test notifications (to prevent flakes in tests). 458 // Set true to disable non-test notifications (to prevent flakes in tests).
459 static bool test_notifications_only_; 459 static bool test_notifications_only_;
460 460
461 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 461 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
462 }; 462 };
463 463
464 } // namespace net 464 } // namespace net
465 465
466 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 466 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698