OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NetworkInformation_h | 5 #ifndef NetworkInformation_h |
6 #define NetworkInformation_h | 6 #define NetworkInformation_h |
7 | 7 |
8 #include "core/dom/ActiveDOMObject.h" | 8 #include "core/dom/ActiveDOMObject.h" |
9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
10 #include "core/page/NetworkStateNotifier.h" | 10 #include "core/page/NetworkStateNotifier.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 , public NetworkStateNotifier::NetworkStateObserver { | 21 , public NetworkStateNotifier::NetworkStateObserver { |
22 REFCOUNTED_EVENT_TARGET(NetworkInformation); | 22 REFCOUNTED_EVENT_TARGET(NetworkInformation); |
23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation); | 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation); |
24 | 24 |
25 public: | 25 public: |
26 static PassRefPtrWillBeRawPtr<NetworkInformation> create(ExecutionContext*); | 26 static PassRefPtrWillBeRawPtr<NetworkInformation> create(ExecutionContext*); |
27 virtual ~NetworkInformation(); | 27 virtual ~NetworkInformation(); |
28 | 28 |
29 String type() const; | 29 String type() const; |
30 | 30 |
31 virtual void connectionTypeChange(blink::WebConnectionType) OVERRIDE; | 31 virtual void connectionTypeChange(WebConnectionType) OVERRIDE; |
32 | 32 |
33 // EventTarget overrides. | 33 // EventTarget overrides. |
34 virtual const AtomicString& interfaceName() const OVERRIDE; | 34 virtual const AtomicString& interfaceName() const OVERRIDE; |
35 virtual ExecutionContext* executionContext() const OVERRIDE; | 35 virtual ExecutionContext* executionContext() const OVERRIDE; |
36 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture = false) OVERRIDE; | 36 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture = false) OVERRIDE; |
37 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E
ventListener>, bool useCapture = false) OVERRIDE; | 37 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E
ventListener>, bool useCapture = false) OVERRIDE; |
38 virtual void removeAllEventListeners() OVERRIDE; | 38 virtual void removeAllEventListeners() OVERRIDE; |
39 | 39 |
40 // ActiveDOMObject overrides. | 40 // ActiveDOMObject overrides. |
41 virtual bool hasPendingActivity() const OVERRIDE; | 41 virtual bool hasPendingActivity() const OVERRIDE; |
42 virtual void stop() OVERRIDE; | 42 virtual void stop() OVERRIDE; |
43 | 43 |
44 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); | 44 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); |
45 | 45 |
46 private: | 46 private: |
47 explicit NetworkInformation(ExecutionContext*); | 47 explicit NetworkInformation(ExecutionContext*); |
48 void startObserving(); | 48 void startObserving(); |
49 void stopObserving(); | 49 void stopObserving(); |
50 | 50 |
51 // Touched only on context thread. | 51 // Touched only on context thread. |
52 blink::WebConnectionType m_type; | 52 WebConnectionType m_type; |
53 | 53 |
54 // Whether this object is listening for events from NetworkStateNotifier. | 54 // Whether this object is listening for events from NetworkStateNotifier. |
55 bool m_observing; | 55 bool m_observing; |
56 | 56 |
57 // Whether ActiveDOMObject::stop has been called. | 57 // Whether ActiveDOMObject::stop has been called. |
58 bool m_contextStopped; | 58 bool m_contextStopped; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace blink | 61 } // namespace blink |
62 | 62 |
63 #endif // NetworkInformation_h | 63 #endif // NetworkInformation_h |
OLD | NEW |