| OLD | NEW |
| 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 #include "net/base/network_change_notifier.h" | 5 #include "net/base/network_change_notifier.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 540 |
| 541 // static | 541 // static |
| 542 NetworkChangeNotifier::ConnectionType | 542 NetworkChangeNotifier::ConnectionType |
| 543 NetworkChangeNotifier::GetConnectionType() { | 543 NetworkChangeNotifier::GetConnectionType() { |
| 544 return g_network_change_notifier ? | 544 return g_network_change_notifier ? |
| 545 g_network_change_notifier->GetCurrentConnectionType() : | 545 g_network_change_notifier->GetCurrentConnectionType() : |
| 546 CONNECTION_UNKNOWN; | 546 CONNECTION_UNKNOWN; |
| 547 } | 547 } |
| 548 | 548 |
| 549 // static | 549 // static |
| 550 NetworkChangeNotifier::ConnectionSubtype |
| 551 NetworkChangeNotifier::GetConnectionSubtype() { |
| 552 return g_network_change_notifier |
| 553 ? g_network_change_notifier->GetCurrentConnectionSubtype() |
| 554 : SUBTYPE_UNKNOWN; |
| 555 } |
| 556 |
| 557 // static |
| 550 void NetworkChangeNotifier::GetMaxBandwidthAndConnectionType( | 558 void NetworkChangeNotifier::GetMaxBandwidthAndConnectionType( |
| 551 double* max_bandwidth_mbps, | 559 double* max_bandwidth_mbps, |
| 552 ConnectionType* connection_type) { | 560 ConnectionType* connection_type) { |
| 553 if (!g_network_change_notifier) { | 561 if (!g_network_change_notifier) { |
| 554 *connection_type = CONNECTION_UNKNOWN; | 562 *connection_type = CONNECTION_UNKNOWN; |
| 555 *max_bandwidth_mbps = GetMaxBandwidthForConnectionSubtype(SUBTYPE_UNKNOWN); | 563 *max_bandwidth_mbps = GetMaxBandwidthForConnectionSubtype(SUBTYPE_UNKNOWN); |
| 556 return; | 564 return; |
| 557 } | 565 } |
| 558 | 566 |
| 559 g_network_change_notifier->GetCurrentMaxBandwidthAndConnectionType( | 567 g_network_change_notifier->GetCurrentMaxBandwidthAndConnectionType( |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 network_change_calculator_->Init(); | 986 network_change_calculator_->Init(); |
| 979 } | 987 } |
| 980 | 988 |
| 981 #if defined(OS_LINUX) | 989 #if defined(OS_LINUX) |
| 982 const internal::AddressTrackerLinux* | 990 const internal::AddressTrackerLinux* |
| 983 NetworkChangeNotifier::GetAddressTrackerInternal() const { | 991 NetworkChangeNotifier::GetAddressTrackerInternal() const { |
| 984 return NULL; | 992 return NULL; |
| 985 } | 993 } |
| 986 #endif | 994 #endif |
| 987 | 995 |
| 996 NetworkChangeNotifier::ConnectionSubtype |
| 997 NetworkChangeNotifier::GetCurrentConnectionSubtype() const { |
| 998 return SUBTYPE_UNKNOWN; |
| 999 } |
| 1000 |
| 988 void NetworkChangeNotifier::GetCurrentMaxBandwidthAndConnectionType( | 1001 void NetworkChangeNotifier::GetCurrentMaxBandwidthAndConnectionType( |
| 989 double* max_bandwidth_mbps, | 1002 double* max_bandwidth_mbps, |
| 990 ConnectionType* connection_type) const { | 1003 ConnectionType* connection_type) const { |
| 991 // This default implementation conforms to the NetInfo V3 specification but | 1004 // This default implementation conforms to the NetInfo V3 specification but |
| 992 // should be overridden to provide specific bandwidth data based on the | 1005 // should be overridden to provide specific bandwidth data based on the |
| 993 // platform. | 1006 // platform. |
| 994 *connection_type = GetCurrentConnectionType(); | 1007 *connection_type = GetCurrentConnectionType(); |
| 995 *max_bandwidth_mbps = | 1008 *max_bandwidth_mbps = |
| 996 *connection_type == CONNECTION_NONE | 1009 *connection_type == CONNECTION_NONE |
| 997 ? GetMaxBandwidthForConnectionSubtype(SUBTYPE_NONE) | 1010 ? GetMaxBandwidthForConnectionSubtype(SUBTYPE_NONE) |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 | 1182 |
| 1170 NetworkChangeNotifier::DisableForTest::~DisableForTest() { | 1183 NetworkChangeNotifier::DisableForTest::~DisableForTest() { |
| 1171 DCHECK(!g_network_change_notifier); | 1184 DCHECK(!g_network_change_notifier); |
| 1172 g_network_change_notifier = network_change_notifier_; | 1185 g_network_change_notifier = network_change_notifier_; |
| 1173 } | 1186 } |
| 1174 | 1187 |
| 1175 void NetworkChangeNotifier::DNSObserver::OnInitialDNSConfigRead() { | 1188 void NetworkChangeNotifier::DNSObserver::OnInitialDNSConfigRead() { |
| 1176 } | 1189 } |
| 1177 | 1190 |
| 1178 } // namespace net | 1191 } // namespace net |
| OLD | NEW |