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 ScreenOrientationController_h |
| 6 #define ScreenOrientationController_h |
| 7 |
| 8 #include "modules/screen_orientation/ScreenOrientation.h" |
| 9 #include "platform/Supplementable.h" |
| 10 #include "wtf/HashSet.h" |
| 11 #include "wtf/PassOwnPtr.h" |
| 12 |
| 13 namespace WebCore { |
| 14 |
| 15 class Page; |
| 16 |
| 17 class ScreenOrientationController : public Supplement<Page> { |
| 18 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
| 19 public: |
| 20 static PassOwnPtr<ScreenOrientationController> create(); |
| 21 virtual ~ScreenOrientationController(); |
| 22 |
| 23 void addObserver(ScreenOrientation*); |
| 24 void removeObserver(ScreenOrientation*); |
| 25 |
| 26 // API for Supplement<Page>. |
| 27 static const char* supplementName(); |
| 28 static ScreenOrientationController* from(Page*); |
| 29 |
| 30 void orientationChanged(ScreenOrientationValue); |
| 31 ScreenOrientationValue orientation() const { return m_orientation; } |
| 32 |
| 33 private: |
| 34 ScreenOrientationController(); |
| 35 |
| 36 ScreenOrientationValue m_orientation; |
| 37 typedef HashSet<ScreenOrientation*> ObserversSet; |
| 38 ObserversSet m_observers; |
| 39 }; |
| 40 |
| 41 void provideScreenOrientationTo(Page*); |
| 42 |
| 43 } // namespace WebCore |
| 44 |
| 45 #endif // ScreenOrientationController_h |
OLD | NEW |