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