Index: Source/modules/netinfo/NetworkInformation.h |
diff --git a/Source/modules/netinfo/NetworkInformation.h b/Source/modules/netinfo/NetworkInformation.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..97912a2957da8fc0f6a74b08ec55f20f21b30fd2 |
--- /dev/null |
+++ b/Source/modules/netinfo/NetworkInformation.h |
@@ -0,0 +1,63 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NetworkInformation_h |
+#define NetworkInformation_h |
+ |
+#include "bindings/v8/ScriptWrappable.h" |
+#include "core/dom/ActiveDOMObject.h" |
+#include "core/events/EventTarget.h" |
+#include "core/page/NetworkStateNotifier.h" |
+#include "public/platform/WebConnectionType.h" |
+ |
+namespace WebCore { |
+ |
+class Dictionary; |
Inactive
2014/05/28 20:18:20
unused?
jkarlin
2014/05/29 11:37:56
Done.
|
+class ExecutionContext; |
+class ServiceWorker; |
Inactive
2014/05/28 20:18:20
unused?
jkarlin
2014/05/29 11:37:56
Done.
|
+ |
+class NetworkInformation FINAL |
+ : public RefCountedWillBeGarbageCollected<NetworkInformation> |
+ , public ScriptWrappable |
+ , public ActiveDOMObject |
+ , public EventTargetWithInlineData |
+ , public NetworkStateNotifier::NetworkStateObserver { |
+ DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeGarbageCollected<NetworkInformation>); |
+ |
+public: |
+ static PassRefPtrWillBeRawPtr<NetworkInformation> create(ExecutionContext*); |
+ ~NetworkInformation(); |
Inactive
2014/05/28 20:18:20
Would be nice to mark it as virtual explicitly.
jkarlin
2014/05/29 11:37:56
Done.
|
+ |
+ String type() const; |
+ |
+ virtual void connectionTypeChange(blink::WebConnectionType) OVERRIDE; |
+ |
+ // EventTarget overrides. |
+ virtual const AtomicString& interfaceName() const OVERRIDE; |
+ virtual ExecutionContext* executionContext() const OVERRIDE; |
+ virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture = false) OVERRIDE; |
+ virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture = false) OVERRIDE; |
+ virtual void removeAllEventListeners() OVERRIDE; |
+ |
+ // ActiveDOMObject overrides. |
+ virtual bool hasPendingActivity() const OVERRIDE; |
+ virtual void stop() OVERRIDE; |
+ |
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); |
+ |
+private: |
+ explicit NetworkInformation(ExecutionContext*); |
+ void startObserving(); |
+ void stopObserving(); |
+ |
+ // Touched only on context thread. |
+ blink::WebConnectionType m_type; |
+ |
+ // Whether this object is listening for events from NetworkStateNotifier. |
+ bool m_observing; |
+}; |
+ |
+} // namespace WebCore |
+ |
+#endif // NetworkInformation_h |