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