Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / screen_orientation / ScreenOrientation.h
index 1091cdb..e48de96 100644 (file)
@@ -5,44 +5,62 @@
 #ifndef ScreenOrientation_h
 #define ScreenOrientation_h
 
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/events/EventTarget.h"
 #include "core/frame/DOMWindowProperty.h"
-#include "platform/Supplementable.h"
-#include "platform/Timer.h"
 #include "platform/heap/Handle.h"
-#include "public/platform/WebScreenOrientationLockType.h"
 #include "public/platform/WebScreenOrientationType.h"
 #include "wtf/text/AtomicString.h"
 #include "wtf/text/WTFString.h"
 
-namespace WebCore {
+namespace blink {
 
-class Document;
+class ExecutionContext;
+class LocalFrame;
 class ScriptPromise;
 class ScriptState;
-class Screen;
+class ScreenOrientationController;
 
-class ScreenOrientation FINAL : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientation>, public WillBeHeapSupplement<Screen>, DOMWindowProperty {
+class ScreenOrientation FINAL
+    : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<ScreenOrientation>
+    , public EventTargetWithInlineData
+    , DOMWindowProperty {
+    DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<ScreenOrientation>);
     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation);
 public:
-    static ScreenOrientation& from(Screen&);
+    static ScreenOrientation* create(LocalFrame*);
+
     virtual ~ScreenOrientation();
 
-    static const AtomicString& orientation(Screen&);
-    static ScriptPromise lockOrientation(ScriptState*, Screen&, const AtomicString& orientation);
-    static void unlockOrientation(Screen&);
+    // EventTarget implementation.
+    virtual const WTF::AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
+
+    String type() const;
+    unsigned short angle() const;
+
+    void setType(WebScreenOrientationType);
+    void setAngle(unsigned short);
+
+    ScriptPromise lock(ScriptState*, const AtomicString& orientation);
+    void unlock();
+
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
 
     // Helper being used by this class and LockOrientationCallback.
-    static const AtomicString& orientationTypeToString(blink::WebScreenOrientationType);
+    static const AtomicString& orientationTypeToString(WebScreenOrientationType);
 
-    virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Screen>::trace(visitor); }
+    virtual void trace(Visitor*) OVERRIDE;
 
 private:
-    explicit ScreenOrientation(Screen&);
+    explicit ScreenOrientation(LocalFrame*);
+
+    ScreenOrientationController* controller();
 
-    static const char* supplementName();
-    Document* document() const;
+    WebScreenOrientationType m_type;
+    unsigned short m_angle;
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // ScreenOrientation_h