| Index: Source/modules/netinfo/NetworkInformation.cpp
|
| diff --git a/Source/modules/netinfo/NetworkInformation.cpp b/Source/modules/netinfo/NetworkInformation.cpp
|
| index a3596e340419781a12f531e405c9263381be5534..0be19dab5d5c709249a4ff08fd809c80a9c56b15 100644
|
| --- a/Source/modules/netinfo/NetworkInformation.cpp
|
| +++ b/Source/modules/netinfo/NetworkInformation.cpp
|
| @@ -9,6 +9,7 @@
|
| #include "core/events/Event.h"
|
| #include "core/page/NetworkStateNotifier.h"
|
| #include "modules/EventTargetModules.h"
|
| +#include "platform/RuntimeEnabledFeatures.h"
|
| #include "wtf/text/WTFString.h"
|
|
|
| namespace {
|
| @@ -26,6 +27,8 @@ String connectionTypeToString(WebConnectionType type)
|
| return "ethernet";
|
| case ConnectionTypeWifi:
|
| return "wifi";
|
| + case ConnectionTypeWimax:
|
| + return "wimax";
|
| case ConnectionTypeOther:
|
| return "other";
|
| case ConnectionTypeNone:
|
| @@ -64,17 +67,29 @@ String NetworkInformation::type() const
|
| return connectionTypeToString(m_type);
|
| }
|
|
|
| -void NetworkInformation::connectionTypeChange(WebConnectionType type)
|
| +double NetworkInformation::downlinkMax() const
|
| +{
|
| + if (!m_observing)
|
| + return networkStateNotifier().maxBandwidth();
|
| +
|
| + return m_downlinkMaxMbps;
|
| +}
|
| +
|
| +void NetworkInformation::connectionChange(WebConnectionType type, double downlinkMaxMbps)
|
| {
|
| ASSERT(executionContext()->isContextThread());
|
|
|
| // This can happen if the observer removes and then adds itself again
|
| // during notification.
|
| - if (m_type == type)
|
| + if (m_type == type && m_downlinkMaxMbps == downlinkMaxMbps)
|
| return;
|
|
|
| m_type = type;
|
| + m_downlinkMaxMbps = downlinkMaxMbps;
|
| dispatchEvent(Event::create(EventTypeNames::typechange));
|
| +
|
| + if (RuntimeEnabledFeatures::netInfoDownlinkMaxEnabled())
|
| + dispatchEvent(Event::create(EventTypeNames::change));
|
| }
|
|
|
| const AtomicString& NetworkInformation::interfaceName() const
|
| @@ -145,6 +160,7 @@ void NetworkInformation::stopObserving()
|
| NetworkInformation::NetworkInformation(ExecutionContext* context)
|
| : ActiveDOMObject(context)
|
| , m_type(networkStateNotifier().connectionType())
|
| + , m_downlinkMaxMbps(networkStateNotifier().maxBandwidth())
|
| , m_observing(false)
|
| , m_contextStopped(false)
|
| {
|
|
|