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