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 ScreenOrientationDispatcher_h | |
6 #define ScreenOrientationDispatcher_h | |
7 | |
8 #include "core/frame/PlatformEventDispatcher.h" | |
9 #include "platform/heap/Handle.h" | |
10 | |
11 namespace blink { | |
12 | |
13 // ScreenOrientationDispatcher is a singleton that handles whether the current | |
14 // Blink instance should be listening to the screen orientation platform events. | |
15 // It is not a common implementation of PlatformEventDispatcher in the sense | |
16 // that it doesn't actually dispatch events but simply start/stop listening. The | |
17 // reason being that screen orientation events are always sent to the WebFrame's | |
18 // but some platforms require to poll to have an accurate reporting. When | |
19 // ScreenOrientationDispatcher is listening, that means that the platform should | |
20 // be polling if required. | |
21 class ScreenOrientationDispatcher final | |
22 : public GarbageCollected<ScreenOrientationDispatcher>, | |
23 public PlatformEventDispatcher { | |
24 USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationDispatcher); | |
25 | |
26 public: | |
27 static ScreenOrientationDispatcher& instance(); | |
28 | |
29 DECLARE_VIRTUAL_TRACE(); | |
30 | |
31 private: | |
32 ScreenOrientationDispatcher(); | |
33 | |
34 // Inherited from PlatformEventDispatcher. | |
35 void startListening() override; | |
36 void stopListening() override; | |
37 }; | |
38 | |
39 } // namespace blink | |
40 | |
41 #endif // ScreenOrientationDispatcher_h | |
OLD | NEW |