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 "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/events/EventTarget.h" |
8 #include "core/frame/DOMWindowProperty.h" | 10 #include "core/frame/DOMWindowProperty.h" |
9 #include "platform/Supplementable.h" | |
10 #include "platform/Timer.h" | |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "public/platform/WebScreenOrientationLockType.h" | |
13 #include "public/platform/WebScreenOrientationType.h" | 12 #include "public/platform/WebScreenOrientationType.h" |
14 #include "wtf/text/AtomicString.h" | 13 #include "wtf/text/AtomicString.h" |
15 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
16 | 15 |
17 namespace WebCore { | 16 namespace WebCore { |
18 | 17 |
19 class Document; | 18 class ExecutionContext; |
| 19 class LocalFrame; |
20 class ScriptPromise; | 20 class ScriptPromise; |
21 class ScriptState; | 21 class ScriptState; |
22 class Screen; | 22 class ScreenOrientationController; |
23 | 23 |
24 class ScreenOrientation FINAL : public NoBaseWillBeGarbageCollectedFinalized<Scr
eenOrientation>, public WillBeHeapSupplement<Screen>, DOMWindowProperty { | 24 class ScreenOrientation FINAL : |
| 25 public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<ScreenOrien
tation>, |
| 26 public EventTargetWithInlineData, |
| 27 DOMWindowProperty { |
| 28 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollectedWi
llBeGarbageCollectedFinalized<ScreenOrientation>); |
25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation); | 29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation); |
26 public: | 30 public: |
27 static ScreenOrientation& from(Screen&); | 31 static ScreenOrientation* create(LocalFrame*); |
| 32 |
28 virtual ~ScreenOrientation(); | 33 virtual ~ScreenOrientation(); |
29 | 34 |
30 static const AtomicString& orientation(Screen&); | 35 // EventTarget implementation. |
31 static ScriptPromise lockOrientation(ScriptState*, Screen&, const AtomicStri
ng& orientation); | 36 virtual const WTF::AtomicString& interfaceName() const OVERRIDE; |
32 static void unlockOrientation(Screen&); | 37 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 38 |
| 39 String type() const; |
| 40 unsigned short angle() const; |
| 41 |
| 42 void setType(blink::WebScreenOrientationType); |
| 43 void setAngle(unsigned short); |
| 44 |
| 45 ScriptPromise lock(ScriptState*, const AtomicString& orientation); |
| 46 void unlock(); |
| 47 |
| 48 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
33 | 49 |
34 // Helper being used by this class and LockOrientationCallback. | 50 // Helper being used by this class and LockOrientationCallback. |
35 static const AtomicString& orientationTypeToString(blink::WebScreenOrientati
onType); | 51 static const AtomicString& orientationTypeToString(blink::WebScreenOrientati
onType); |
36 | 52 |
37 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Screen>
::trace(visitor); } | 53 virtual void trace(Visitor*) OVERRIDE; |
38 | 54 |
39 private: | 55 private: |
40 explicit ScreenOrientation(Screen&); | 56 explicit ScreenOrientation(LocalFrame*); |
41 | 57 |
42 static const char* supplementName(); | 58 ScreenOrientationController* controller(); |
43 Document* document() const; | 59 |
| 60 blink::WebScreenOrientationType m_type; |
| 61 unsigned short m_angle; |
44 }; | 62 }; |
45 | 63 |
46 } // namespace WebCore | 64 } // namespace WebCore |
47 | 65 |
48 #endif // ScreenOrientation_h | 66 #endif // ScreenOrientation_h |
OLD | NEW |