Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/modules/device_orientation/DeviceOrientationEvent.h

Issue 2720003003: Implement DeviceOrientationEvent constructor. (Closed)
Patch Set: Reference Candidate Recommendation. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2010, The Android Open Source Project 2 * Copyright 2010, The Android Open Source Project
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef DeviceOrientationEvent_h 26 #ifndef DeviceOrientationEvent_h
27 #define DeviceOrientationEvent_h 27 #define DeviceOrientationEvent_h
28 28
29 #include "bindings/core/v8/Nullable.h" 29 #include "bindings/core/v8/Nullable.h"
30 #include "modules/EventModules.h" 30 #include "modules/EventModules.h"
31 #include "platform/heap/Handle.h" 31 #include "platform/heap/Handle.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class DeviceOrientationEventInit;
35 class DeviceOrientationData; 36 class DeviceOrientationData;
36 37
37 class DeviceOrientationEvent final : public Event { 38 class DeviceOrientationEvent final : public Event {
38 DEFINE_WRAPPERTYPEINFO(); 39 DEFINE_WRAPPERTYPEINFO();
39 40
40 public: 41 public:
41 ~DeviceOrientationEvent() override; 42 ~DeviceOrientationEvent() override;
42 static DeviceOrientationEvent* create() { return new DeviceOrientationEvent; } 43 static DeviceOrientationEvent* create() { return new DeviceOrientationEvent; }
44 static DeviceOrientationEvent* create(
45 const AtomicString& eventType,
46 const DeviceOrientationEventInit& initializer) {
47 return new DeviceOrientationEvent(eventType, initializer);
48 }
43 static DeviceOrientationEvent* create(const AtomicString& eventType, 49 static DeviceOrientationEvent* create(const AtomicString& eventType,
44 DeviceOrientationData* orientation) { 50 DeviceOrientationData* orientation) {
45 return new DeviceOrientationEvent(eventType, orientation); 51 return new DeviceOrientationEvent(eventType, orientation);
46 } 52 }
47 53
48 void initDeviceOrientationEvent(const AtomicString& type, 54 void initDeviceOrientationEvent(const AtomicString& type,
49 bool bubbles, 55 bool bubbles,
50 bool cancelable, 56 bool cancelable,
51 const Nullable<double>& alpha, 57 const Nullable<double>& alpha,
52 const Nullable<double>& beta, 58 const Nullable<double>& beta,
53 const Nullable<double>& gamma, 59 const Nullable<double>& gamma,
54 bool absolute); 60 bool absolute);
55 61
56 DeviceOrientationData* orientation() const { return m_orientation.get(); } 62 DeviceOrientationData* orientation() const { return m_orientation.get(); }
57 63
58 double alpha(bool& isNull) const; 64 double alpha(bool& isNull) const;
59 double beta(bool& isNull) const; 65 double beta(bool& isNull) const;
60 double gamma(bool& isNull) const; 66 double gamma(bool& isNull) const;
61 bool absolute() const; 67 bool absolute() const;
62 68
63 const AtomicString& interfaceName() const override; 69 const AtomicString& interfaceName() const override;
64 70
65 DECLARE_VIRTUAL_TRACE(); 71 DECLARE_VIRTUAL_TRACE();
66 72
67 private: 73 private:
68 DeviceOrientationEvent(); 74 DeviceOrientationEvent();
75 DeviceOrientationEvent(const AtomicString&,
76 const DeviceOrientationEventInit&);
69 DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientationData*); 77 DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientationData*);
70 78
71 Member<DeviceOrientationData> m_orientation; 79 Member<DeviceOrientationData> m_orientation;
72 }; 80 };
73 81
74 DEFINE_TYPE_CASTS(DeviceOrientationEvent, 82 DEFINE_TYPE_CASTS(DeviceOrientationEvent,
75 Event, 83 Event,
76 event, 84 event,
77 event->interfaceName() == EventNames::DeviceOrientationEvent, 85 event->interfaceName() == EventNames::DeviceOrientationEvent,
78 event.interfaceName() == EventNames::DeviceOrientationEvent); 86 event.interfaceName() == EventNames::DeviceOrientationEvent);
79 87
80 } // namespace blink 88 } // namespace blink
81 89
82 #endif // DeviceOrientationEvent_h 90 #endif // DeviceOrientationEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698