OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NetworkInformation_h | |
6 #define NetworkInformation_h | |
7 | |
8 #include "bindings/v8/ScriptWrappable.h" | |
9 #include "core/dom/ActiveDOMObject.h" | |
10 #include "core/events/EventTarget.h" | |
11 #include "core/page/NetworkStateNotifier.h" | |
12 #include "public/platform/WebConnectionType.h" | |
13 | |
14 namespace WebCore { | |
15 | |
16 class Dictionary; | |
Inactive
2014/05/28 20:18:20
unused?
jkarlin
2014/05/29 11:37:56
Done.
| |
17 class ExecutionContext; | |
18 class ServiceWorker; | |
Inactive
2014/05/28 20:18:20
unused?
jkarlin
2014/05/29 11:37:56
Done.
| |
19 | |
20 class NetworkInformation FINAL | |
21 : public RefCountedWillBeGarbageCollected<NetworkInformation> | |
22 , public ScriptWrappable | |
23 , public ActiveDOMObject | |
24 , public EventTargetWithInlineData | |
25 , public NetworkStateNotifier::NetworkStateObserver { | |
26 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeGarbageCollected<NetworkInfo rmation>); | |
27 | |
28 public: | |
29 static PassRefPtrWillBeRawPtr<NetworkInformation> create(ExecutionContext*); | |
30 ~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.
| |
31 | |
32 String type() const; | |
33 | |
34 virtual void connectionTypeChange(blink::WebConnectionType) OVERRIDE; | |
35 | |
36 // EventTarget overrides. | |
37 virtual const AtomicString& interfaceName() const OVERRIDE; | |
38 virtual ExecutionContext* executionContext() const OVERRIDE; | |
39 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE; | |
40 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false) OVERRIDE; | |
41 virtual void removeAllEventListeners() OVERRIDE; | |
42 | |
43 // ActiveDOMObject overrides. | |
44 virtual bool hasPendingActivity() const OVERRIDE; | |
45 virtual void stop() OVERRIDE; | |
46 | |
47 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); | |
48 | |
49 private: | |
50 explicit NetworkInformation(ExecutionContext*); | |
51 void startObserving(); | |
52 void stopObserving(); | |
53 | |
54 // Touched only on context thread. | |
55 blink::WebConnectionType m_type; | |
56 | |
57 // Whether this object is listening for events from NetworkStateNotifier. | |
58 bool m_observing; | |
59 }; | |
60 | |
61 } // namespace WebCore | |
62 | |
63 #endif // NetworkInformation_h | |
OLD | NEW |