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

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: Minor browser test fix 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
« no previous file with comments | « content/test/data/net_info.html ('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> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // connection then it is set to 0.0. The circumstances in which a more 240 // connection then it is set to 0.0. The circumstances in which a more
241 // specific value is given are: when an Android device is connected to a 241 // specific value is given are: when an Android device is connected to a
242 // cellular or WiFi network, and when a ChromeOS device is connected to a 242 // cellular or WiFi network, and when a ChromeOS device is connected to a
243 // cellular network. See the NetInfo spec for the mapping of 243 // cellular network. See the NetInfo spec for the mapping of
244 // specific subtypes to bandwidth values: http://w3c.github.io/netinfo/. 244 // specific subtypes to bandwidth values: http://w3c.github.io/netinfo/.
245 // |connection_type| is set to the current active default network's connection 245 // |connection_type| is set to the current active default network's connection
246 // type. 246 // type.
247 static void GetMaxBandwidthAndConnectionType(double* max_bandwidth_mbps, 247 static void GetMaxBandwidthAndConnectionType(double* max_bandwidth_mbps,
248 ConnectionType* connection_type); 248 ConnectionType* connection_type);
249 249
250 // Returns a theoretical upper limit (in Mbps) on download bandwidth given a
251 // connection subtype. The mapping of connection type to maximum bandwidth is
252 // provided in the NetInfo spec: http://w3c.github.io/netinfo/.
253 // TODO(jkarlin): Rename to GetMaxBandwidthMbpsForConnectionSubtype.
254 static double GetMaxBandwidthForConnectionSubtype(ConnectionSubtype subtype);
255
250 // Retrieve the last read DnsConfig. This could be expensive if the system has 256 // Retrieve the last read DnsConfig. This could be expensive if the system has
251 // a large HOSTS file. 257 // a large HOSTS file.
252 static void GetDnsConfig(DnsConfig* config); 258 static void GetDnsConfig(DnsConfig* config);
253 259
254 #if defined(OS_LINUX) 260 #if defined(OS_LINUX)
255 // Returns the AddressTrackerLinux if present. 261 // Returns the AddressTrackerLinux if present.
256 static const internal::AddressTrackerLinux* GetAddressTracker(); 262 static const internal::AddressTrackerLinux* GetAddressTracker();
257 #endif 263 #endif
258 264
259 // Convenience method to determine if the user is offline. 265 // Convenience method to determine if the user is offline.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 GetAddressTrackerInternal() const; 403 GetAddressTrackerInternal() const;
398 #endif 404 #endif
399 405
400 // See the description of NetworkChangeNotifier::GetMaxBandwidth(). 406 // See the description of NetworkChangeNotifier::GetMaxBandwidth().
401 // Implementations must be thread-safe. Implementations must also be 407 // Implementations must be thread-safe. Implementations must also be
402 // cheap as it is called often. 408 // cheap as it is called often.
403 virtual void GetCurrentMaxBandwidthAndConnectionType( 409 virtual void GetCurrentMaxBandwidthAndConnectionType(
404 double* max_bandwidth_mbps, 410 double* max_bandwidth_mbps,
405 ConnectionType* connection_type) const; 411 ConnectionType* connection_type) const;
406 412
407 // Returns a theoretical upper limit on download bandwidth given a connection
408 // subtype. The mapping of connection type to maximum bandwidth is provided in
409 // the NetInfo spec: http://w3c.github.io/netinfo/.
410 static double GetMaxBandwidthForConnectionSubtype(ConnectionSubtype subtype);
411
412 // Broadcasts a notification to all registered observers. Note that this 413 // Broadcasts a notification to all registered observers. Note that this
413 // happens asynchronously, even for observers on the current thread, even in 414 // happens asynchronously, even for observers on the current thread, even in
414 // tests. 415 // tests.
415 static void NotifyObserversOfIPAddressChange(); 416 static void NotifyObserversOfIPAddressChange();
416 static void NotifyObserversOfConnectionTypeChange(); 417 static void NotifyObserversOfConnectionTypeChange();
417 static void NotifyObserversOfDNSChange(); 418 static void NotifyObserversOfDNSChange();
418 static void NotifyObserversOfInitialDNSConfigRead(); 419 static void NotifyObserversOfInitialDNSConfigRead();
419 static void NotifyObserversOfNetworkChange(ConnectionType type); 420 static void NotifyObserversOfNetworkChange(ConnectionType type);
420 static void NotifyObserversOfMaxBandwidthChange(double max_bandwidth_mbps, 421 static void NotifyObserversOfMaxBandwidthChange(double max_bandwidth_mbps,
421 ConnectionType type); 422 ConnectionType type);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 466
466 // Set true to disable non-test notifications (to prevent flakes in tests). 467 // Set true to disable non-test notifications (to prevent flakes in tests).
467 static bool test_notifications_only_; 468 static bool test_notifications_only_;
468 469
469 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 470 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
470 }; 471 };
471 472
472 } // namespace net 473 } // namespace net
473 474
474 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 475 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « content/test/data/net_info.html ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698