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/frame/DOMWindowProperty.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "platform/Supplementable.h" | 9 #include "core/dom/ActiveDOMObject.h" |
10 #include "platform/Timer.h" | 10 #include "core/events/EventTarget.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; |
20 class ScriptPromise; | 19 class ScriptPromise; |
21 class ScriptState; | 20 class ScriptState; |
22 class Screen; | 21 class ScreenOrientationController; |
23 | 22 |
24 class ScreenOrientation FINAL : public NoBaseWillBeGarbageCollectedFinalized<Scr eenOrientation>, public WillBeHeapSupplement<Screen>, DOMWindowProperty { | 23 class ScreenOrientation FINAL : |
24 public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<ScreenOrien tation>, | |
25 public EventTargetWithInlineData, | |
26 public ActiveDOMObject { | |
abarth-chromium
2014/07/07 17:29:33
You shouldn't need to be an ActiveDOMObject
mlamouri (slow - plz ping)
2014/07/08 14:07:59
So, I tried to find out when ActiveDOMObject was n
| |
27 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollectedWi llBeGarbageCollectedFinalized<ScreenOrientation>); | |
25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation); | 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation); |
26 public: | 29 public: |
27 static ScreenOrientation& from(Screen&); | 30 static ScreenOrientation* create(ScreenOrientationController*, ExecutionCont ext*); |
31 | |
28 virtual ~ScreenOrientation(); | 32 virtual ~ScreenOrientation(); |
29 | 33 |
30 static const AtomicString& orientation(Screen&); | 34 // EventTarget implementation. |
31 static ScriptPromise lockOrientation(ScriptState*, Screen&, const AtomicStri ng& orientation); | 35 virtual const WTF::AtomicString& interfaceName() const OVERRIDE; |
32 static void unlockOrientation(Screen&); | 36 virtual ExecutionContext* executionContext() const OVERRIDE; |
37 | |
38 String type() const; | |
39 unsigned short angle() const; | |
40 | |
41 void setType(blink::WebScreenOrientationType); | |
42 void setAngle(unsigned short); | |
43 | |
44 ScriptPromise lock(ScriptState*, const AtomicString& orientation); | |
45 void unlock(); | |
46 | |
47 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | |
48 | |
49 // ActiveDOMObject overrides. | |
50 virtual bool hasPendingActivity() const OVERRIDE; | |
33 | 51 |
34 // Helper being used by this class and LockOrientationCallback. | 52 // Helper being used by this class and LockOrientationCallback. |
35 static const AtomicString& orientationTypeToString(blink::WebScreenOrientati onType); | 53 static const AtomicString& orientationTypeToString(blink::WebScreenOrientati onType); |
36 | 54 |
37 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Screen> ::trace(visitor); } | 55 virtual void trace(Visitor*) OVERRIDE; |
38 | 56 |
39 private: | 57 private: |
40 explicit ScreenOrientation(Screen&); | 58 explicit ScreenOrientation(ScreenOrientationController*, ExecutionContext*); |
41 | 59 |
42 static const char* supplementName(); | 60 ScreenOrientationController* m_controller; |
43 Document* document() const; | 61 |
62 blink::WebScreenOrientationType m_type; | |
63 unsigned short m_angle; | |
44 }; | 64 }; |
45 | 65 |
46 } // namespace WebCore | 66 } // namespace WebCore |
47 | 67 |
48 #endif // ScreenOrientation_h | 68 #endif // ScreenOrientation_h |
OLD | NEW |