16fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org/*
253a13f1fa964820f7a8f9d3932a6f3c0433f8bf5fgalligan@chromium.org * Copyright 2010, The Android Open Source Project
36fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *
46fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org * Redistribution and use in source and binary forms, with or without
56fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org * modification, are permitted provided that the following conditions
66fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org * are met:
76fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  * Redistributions of source code must retain the above copyright
86fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *    notice, this list of conditions and the following disclaimer.
96fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  * Redistributions in binary form must reproduce the above copyright
106fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *    notice, this list of conditions and the following disclaimer in the
11ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org *    documentation and/or other materials provided with the distribution.
12ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org *
13ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.org * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.org * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
196fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2190c5310de3dfbd1b1624502616cbc8aaf9ad25f0johannkoenig@chromium.org * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org */
25ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org
2690c5310de3dfbd1b1624502616cbc8aaf9ad25f0johannkoenig@chromium.org#ifndef DeviceOrientationEvent_h
27d95585fb0ec024f6abd96f7b02e0df58019d46afjohannkoenig@chromium.org#define DeviceOrientationEvent_h
286fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
29ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org#include "modules/EventModules.h"
30d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.org#include "platform/heap/Handle.h"
3193a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org
3293a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgnamespace blink {
3393a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org
34411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.orgclass DeviceOrientationData;
35693441efe611de7ca09c00f4e79776f604b689f4joeyparrish@google.com
3693a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgclass DeviceOrientationEvent FINAL : public Event {
37d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.org    DEFINE_WRAPPERTYPEINFO();
386fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgpublic:
39ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org    virtual ~DeviceOrientationEvent();
40693441efe611de7ca09c00f4e79776f604b689f4joeyparrish@google.com    static PassRefPtrWillBeRawPtr<DeviceOrientationEvent> create()
41ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org    {
426fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org        return adoptRefWillBeNoop(new DeviceOrientationEvent);
43e2064011d36b2008099446503f28e64d445060ecjohannkoenig@chromium.org    }
44ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org    static PassRefPtrWillBeRawPtr<DeviceOrientationEvent> create(const AtomicString& eventType, DeviceOrientationData* orientation)
4593a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org    {
4693a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org        return adoptRefWillBeNoop(new DeviceOrientationEvent(eventType, orientation));
4793a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org    }
4893a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org
496fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData*);
50dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
5193a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org    DeviceOrientationData* orientation() const { return m_orientation.get(); }
52ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org
53d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.org    double alpha(bool& isNull) const;
546fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    double beta(bool& isNull) const;
556fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    double gamma(bool& isNull) const;
566fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    bool absolute(bool& isNull) const;
57ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org
58ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org    virtual const AtomicString& interfaceName() const OVERRIDE;
59ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org
60ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org    virtual void trace(Visitor*) OVERRIDE;
61ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org
62ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.orgprivate:
636fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    DeviceOrientationEvent();
646fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientationData*);
656fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
6688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    PersistentWillBeMember<DeviceOrientationData> m_orientation;
67e2064011d36b2008099446503f28e64d445060ecjohannkoenig@chromium.org};
6888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
696fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgDEFINE_TYPE_CASTS(DeviceOrientationEvent, Event, event, event->interfaceName() == EventNames::DeviceOrientationEvent, event.interfaceName() == EventNames::DeviceOrientationEvent);
706fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
716fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org} // namespace blink
726fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
736fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#endif // DeviceOrientationEvent_h
746fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org