| Index: Source/modules/netinfo/NetworkInfoConnection.h
|
| diff --git a/Source/modules/netinfo/NetworkInfoConnection.h b/Source/modules/netinfo/NetworkInfoConnection.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2087b7bc6617f2d3f0f35b54f8add326e3e1dac7
|
| --- /dev/null
|
| +++ b/Source/modules/netinfo/NetworkInfoConnection.h
|
| @@ -0,0 +1,65 @@
|
| +// 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 NetworkInfoConnection_h
|
| +#define NetworkInfoConnection_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;
|
| +class ExecutionContext;
|
| +class ServiceWorker;
|
| +
|
| +class NetworkInfoConnection FINAL
|
| + : public RefCountedWillBeGarbageCollected<NetworkInfoConnection>
|
| + , public ScriptWrappable
|
| + , public ActiveDOMObject
|
| + , public EventTargetWithInlineData
|
| + , public NetworkStateNotifier::NetworkStateObserver {
|
| + DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeGarbageCollected<NetworkInfoConnection>);
|
| +
|
| +public:
|
| + static PassRefPtrWillBeRawPtr<NetworkInfoConnection> create(ExecutionContext*);
|
| + ~NetworkInfoConnection();
|
| +
|
| + 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);
|
| +
|
| + void trace(Visitor*);
|
| +
|
| +private:
|
| + explicit NetworkInfoConnection(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 // NetworkInfoConnection_h
|
|
|