OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Apple Inc. All rights reserved. | 2 * Copyright 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef DeviceMotionController_h | 27 #ifndef DeviceMotionController_h |
28 #define DeviceMotionController_h | 28 #define DeviceMotionController_h |
29 | 29 |
30 #include "core/dom/Event.h" | 30 #include "core/dom/Event.h" |
31 #include "core/page/DOMWindowLifecycleObserver.h" | 31 #include "core/page/DOMWindowLifecycleObserver.h" |
| 32 #include "core/page/PageLifecycleObserver.h" |
32 #include "core/platform/Supplementable.h" | 33 #include "core/platform/Supplementable.h" |
33 #include "modules/device_orientation/DeviceSensorEventController.h" | 34 #include "modules/device_orientation/DeviceSensorEventController.h" |
34 | 35 |
35 namespace WebCore { | 36 namespace WebCore { |
36 | 37 |
37 class DeviceMotionData; | 38 class DeviceMotionData; |
38 class DOMWindow; | 39 class DOMWindow; |
39 | 40 |
40 class DeviceMotionController : public DeviceSensorEventController, public Supple
ment<ScriptExecutionContext>, public DOMWindowLifecycleObserver { | 41 class DeviceMotionController : public DeviceSensorEventController, public Supple
ment<ScriptExecutionContext>, public DOMWindowLifecycleObserver, public PageLife
cycleObserver { |
41 | 42 |
42 public: | 43 public: |
43 virtual ~DeviceMotionController(); | 44 virtual ~DeviceMotionController(); |
44 | 45 |
45 static const char* supplementName(); | 46 static const char* supplementName(); |
46 static DeviceMotionController* from(Document*); | 47 static DeviceMotionController* from(Document*); |
47 | 48 |
48 void didChangeDeviceMotion(DeviceMotionData*); | 49 void didChangeDeviceMotion(DeviceMotionData*); |
49 | 50 |
50 // Inherited from DOMWindowLifecycleObserver | |
51 virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE; | |
52 virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRID
E; | |
53 virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE; | |
54 | |
55 private: | 51 private: |
56 explicit DeviceMotionController(Document*); | 52 explicit DeviceMotionController(Document*); |
57 virtual void registerWithDispatcher() OVERRIDE; | 53 virtual void registerWithDispatcher() OVERRIDE; |
58 virtual void unregisterWithDispatcher() OVERRIDE; | 54 virtual void unregisterWithDispatcher() OVERRIDE; |
59 | 55 |
| 56 // Inherited from DOMWindowLifecycleObserver. |
| 57 virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE; |
| 58 virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRID
E; |
| 59 virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE; |
| 60 |
| 61 // Inherited from PageLifecycleObserver. |
| 62 virtual void pageVisibilityChanged() OVERRIDE; |
| 63 |
60 virtual bool hasLastData() OVERRIDE; | 64 virtual bool hasLastData() OVERRIDE; |
61 virtual PassRefPtr<Event> getLastEvent() OVERRIDE; | 65 virtual PassRefPtr<Event> getLastEvent() OVERRIDE; |
62 virtual bool isNullEvent(Event*) OVERRIDE; | 66 virtual bool isNullEvent(Event*) OVERRIDE; |
| 67 |
| 68 bool m_hasEventListener; |
63 }; | 69 }; |
64 | 70 |
65 } // namespace WebCore | 71 } // namespace WebCore |
66 | 72 |
67 #endif // DeviceMotionController_h | 73 #endif // DeviceMotionController_h |
OLD | NEW |