summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_throttler_manager.cc
diff options
context:
space:
mode:
authordroger@google.com <droger@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 11:30:05 +0000
committerdroger@google.com <droger@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 11:30:05 +0000
commit8bbc7a79b07a8ea33b356492947ad8d455ab438a (patch)
tree2b7e728f0eb8467d51390846d1059595347a1d36 /net/url_request/url_request_throttler_manager.cc
parent9f230ed18793828c7f1776189b5b66a5b5f07771 (diff)
downloadchromium_src-8bbc7a79b07a8ea33b356492947ad8d455ab438a.zip
chromium_src-8bbc7a79b07a8ea33b356492947ad8d455ab438a.tar.gz
chromium_src-8bbc7a79b07a8ea33b356492947ad8d455ab438a.tar.bz2
Support for navigator.connection API
This replaces the online state (a boolean) by a more complex state (UNKNOWN/NONE /2G/3G/4G/WIFI/ETHERNET) inspired by the Network Information API (http://www.w3.org/TR/netinfo-api/). Breakdown of the modified files: - network_change_notifier.h/.cc: actual API change - network_change_notifier_*: platform specific implementations. This CL only provide a basic implementation where CONNECTION_UNKNOWN is returned when online and CONNECTION_NONE is returned when offline. - other files: call sites for the static function and observer implementations. Most of the time this only changes the test IsOffline() by (GetConnectionType() == CONNECTION_NONE). BUG=112937 TEST=NONE Review URL: https://chromiumcodereview.appspot.com/9147026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request_throttler_manager.cc')
-rw-r--r--net/url_request/url_request_throttler_manager.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc
index c2fa430..5c50558 100644
--- a/net/url_request/url_request_throttler_manager.cc
+++ b/net/url_request/url_request_throttler_manager.cc
@@ -28,12 +28,12 @@ URLRequestThrottlerManager::URLRequestThrottlerManager()
url_id_replacements_.ClearRef();
NetworkChangeNotifier::AddIPAddressObserver(this);
- NetworkChangeNotifier::AddOnlineStateObserver(this);
+ NetworkChangeNotifier::AddConnectionTypeObserver(this);
}
URLRequestThrottlerManager::~URLRequestThrottlerManager() {
NetworkChangeNotifier::RemoveIPAddressObserver(this);
- NetworkChangeNotifier::RemoveOnlineStateObserver(this);
+ NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
// Since, for now, the manager object might conceivably go away before
// the entries, detach the entries' back-pointer to the manager.
@@ -166,7 +166,8 @@ void URLRequestThrottlerManager::OnIPAddressChanged() {
OnNetworkChange();
}
-void URLRequestThrottlerManager::OnOnlineStateChanged(bool online) {
+void URLRequestThrottlerManager::OnConnectionTypeChanged(
+ NetworkChangeNotifier::ConnectionType type) {
OnNetworkChange();
}
@@ -207,7 +208,7 @@ void URLRequestThrottlerManager::OnNetworkChange() {
// Remove all entries. Any entries that in-flight requests have a reference
// to will live until those requests end, and these entries may be
// inconsistent with new entries for the same URLs, but since what we
- // want is a clean slate for the new connection state, this is OK.
+ // want is a clean slate for the new connection type, this is OK.
url_entries_.clear();
requests_since_last_gc_ = 0;
}