OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
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 | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef DeviceOrientationDispatcher_h | 31 #ifndef DeviceOrientationDispatcher_h |
32 #define DeviceOrientationDispatcher_h | 32 #define DeviceOrientationDispatcher_h |
33 | 33 |
34 #include "core/frame/PlatformEventDispatcher.h" | 34 #include "core/frame/PlatformEventDispatcher.h" |
35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
36 #include "public/platform/WebPlatformEventType.h" | 36 #include "public/platform/WebPlatformEventType.h" |
37 #include "public/platform/modules/device_orientation/WebDeviceOrientationListene
r.h" | 37 #include "public/platform/modules/device_orientation/WebDeviceOrientationListene
r.h" |
38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
39 | 39 |
| 40 namespace device { |
| 41 class OrientationData; |
| 42 } |
| 43 |
40 namespace blink { | 44 namespace blink { |
41 | 45 |
42 class DeviceOrientationData; | 46 class DeviceOrientationData; |
43 class WebDeviceOrientationData; | |
44 | 47 |
45 // This class listens to device orientation data and notifies all registered | 48 // This class listens to device orientation data and notifies all registered |
46 // controllers. | 49 // controllers. |
47 class DeviceOrientationDispatcher final | 50 class DeviceOrientationDispatcher final |
48 : public GarbageCollectedFinalized<DeviceOrientationDispatcher>, | 51 : public GarbageCollectedFinalized<DeviceOrientationDispatcher>, |
49 public PlatformEventDispatcher, | 52 public PlatformEventDispatcher, |
50 public WebDeviceOrientationListener { | 53 public WebDeviceOrientationListener { |
51 USING_GARBAGE_COLLECTED_MIXIN(DeviceOrientationDispatcher); | 54 USING_GARBAGE_COLLECTED_MIXIN(DeviceOrientationDispatcher); |
52 | 55 |
53 public: | 56 public: |
54 static DeviceOrientationDispatcher& instance(bool absolute); | 57 static DeviceOrientationDispatcher& instance(bool absolute); |
55 ~DeviceOrientationDispatcher() override; | 58 ~DeviceOrientationDispatcher() override; |
56 | 59 |
57 // Note that the returned object is owned by this class. | 60 // Note that the returned object is owned by this class. |
58 // FIXME: make the return value const, see crbug.com/233174. | 61 // FIXME: make the return value const, see crbug.com/233174. |
59 DeviceOrientationData* latestDeviceOrientationData(); | 62 DeviceOrientationData* latestDeviceOrientationData(); |
60 | 63 |
61 // Inherited from WebDeviceOrientationListener. | 64 // Inherited from WebDeviceOrientationListener. |
62 void didChangeDeviceOrientation(const WebDeviceOrientationData&) override; | 65 void didChangeDeviceOrientation(const device::OrientationData&) override; |
63 | 66 |
64 DECLARE_VIRTUAL_TRACE(); | 67 DECLARE_VIRTUAL_TRACE(); |
65 | 68 |
66 private: | 69 private: |
67 explicit DeviceOrientationDispatcher(bool absolute); | 70 explicit DeviceOrientationDispatcher(bool absolute); |
68 | 71 |
69 // Inherited from PlatformEventDispatcher. | 72 // Inherited from PlatformEventDispatcher. |
70 void startListening() override; | 73 void startListening() override; |
71 void stopListening() override; | 74 void stopListening() override; |
72 | 75 |
73 WebPlatformEventType getWebPlatformEventType() const; | 76 WebPlatformEventType getWebPlatformEventType() const; |
74 | 77 |
75 const bool m_absolute; | 78 const bool m_absolute; |
76 Member<DeviceOrientationData> m_lastDeviceOrientationData; | 79 Member<DeviceOrientationData> m_lastDeviceOrientationData; |
77 }; | 80 }; |
78 | 81 |
79 } // namespace blink | 82 } // namespace blink |
80 | 83 |
81 #endif // DeviceOrientationDispatcher_h | 84 #endif // DeviceOrientationDispatcher_h |
OLD | NEW |