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 ScreenOrientation_h | 5 #ifndef ScreenOrientation_h |
6 #define ScreenOrientation_h | 6 #define ScreenOrientation_h |
7 | 7 |
8 #include "core/events/EventTarget.h" | 8 #include "core/events/EventTarget.h" |
9 #include "core/frame/DOMWindowProperty.h" | 9 #include "core/frame/DOMWindowProperty.h" |
10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
| 11 #include "platform/Timer.h" |
| 12 #include "public/platform/WebScreenOrientation.h" |
11 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
12 #include "wtf/text/AtomicString.h" | 14 #include "wtf/text/AtomicString.h" |
13 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
14 | 16 |
15 namespace WebCore { | 17 namespace WebCore { |
16 | 18 |
17 class Document; | 19 class Document; |
18 class Screen; | 20 class Screen; |
19 | 21 |
20 class ScreenOrientation FINAL : public Supplement<Screen>, DOMWindowProperty { | 22 class ScreenOrientation FINAL : public Supplement<Screen>, DOMWindowProperty { |
21 public: | 23 public: |
22 static ScreenOrientation& from(Screen&); | 24 static ScreenOrientation& from(Screen&); |
23 virtual ~ScreenOrientation(); | 25 virtual ~ScreenOrientation(); |
24 | 26 |
25 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(orientationchange); | 27 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
26 | 28 |
27 static const AtomicString& orientation(Screen&); | 29 static const AtomicString& orientation(Screen&); |
28 static bool lockOrientation(Screen&, const Vector<String>& orientations); | 30 static bool lockOrientation(Screen&, const Vector<String>& orientations); |
29 static bool lockOrientation(Screen&, const AtomicString& orientation); | 31 static bool lockOrientation(Screen&, const AtomicString& orientation); |
30 static void unlockOrientation(Screen&); | 32 static void unlockOrientation(Screen&); |
31 | 33 |
32 private: | 34 private: |
33 explicit ScreenOrientation(Screen&); | 35 explicit ScreenOrientation(Screen&); |
| 36 |
| 37 void lockOrientationAsync(blink::WebScreenOrientations); |
| 38 void orientationLockTimerFired(Timer<ScreenOrientation>*); |
| 39 |
34 static const char* supplementName(); | 40 static const char* supplementName(); |
35 Document& document() const; | 41 Document& document() const; |
| 42 |
| 43 Timer<ScreenOrientation> m_orientationLockTimer; |
| 44 blink::WebScreenOrientations m_lockedOrientations; |
36 }; | 45 }; |
37 | 46 |
38 } // namespace WebCore | 47 } // namespace WebCore |
39 | 48 |
40 #endif // ScreenOrientation_h | 49 #endif // ScreenOrientation_h |
OLD | NEW |