Home | History | Annotate | Download | only in screen_orientation
      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 
     10 namespace blink {
     11 
     12 class FrameView;
     13 class ScreenOrientation;
     14 
     15 // ScreenOrientationDispatcher is a singleton that handles whether the current
     16 // Blink instance should be listening to the screen orientation platform events.
     17 // 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
     19 // 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
     21 // ScreenOrientationDispatcher is listening, that means that the platform should
     22 // be polling if required.
     23 class ScreenOrientationDispatcher FINAL :
     24     public PlatformEventDispatcher {
     25 public:
     26     static ScreenOrientationDispatcher& instance();
     27 
     28 private:
     29     ScreenOrientationDispatcher();
     30     virtual ~ScreenOrientationDispatcher();
     31 
     32     // Inherited from PlatformEventDispatcher.
     33     virtual void startListening() OVERRIDE;
     34     virtual void stopListening() OVERRIDE;
     35 };
     36 
     37 } // namespace blink
     38 
     39 #endif // ScreenOrientationDispatcher_h
     40