Chromium Code Reviews| Index: Source/modules/device_light/DeviceLightEvent.h |
| diff --git a/Source/modules/device_light/DeviceLightEvent.h b/Source/modules/device_light/DeviceLightEvent.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a2cb7a13106ad417491d94d81b1201ee50656119 |
| --- /dev/null |
| +++ b/Source/modules/device_light/DeviceLightEvent.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DeviceLightEvent_h |
| +#define DeviceLightEvent_h |
| + |
| +#include "core/events/Event.h" |
| +#include "heap/Handle.h" |
| + |
| +namespace WebCore { |
| + |
| +struct DeviceLightEventInit : public EventInit { |
| + DeviceLightEventInit() |
| + : value(std::numeric_limits<double>::infinity()) |
| + { |
| + bubbles = true; |
| + }; |
| + |
| + double value; |
| +}; |
| + |
| +class DeviceLightEvent FINAL : public Event { |
| +public: |
| + virtual ~DeviceLightEvent(); |
| + |
| + static PassRefPtrWillBeRawPtr<DeviceLightEvent> create() |
|
sof
2014/03/20 16:27:15
Make this PassRefPtr<> only for now; Event hasn't
riju_
2014/03/20 20:12:29
Done.
|
| + { |
| + return adoptRefWillBeRefCountedGarbageCollected(new DeviceLightEvent); |
|
sof
2014/03/20 16:27:15
Similarly, just adoptRef()
riju_
2014/03/20 20:12:29
Done.
|
| + } |
| + static PassRefPtrWillBeRawPtr<DeviceLightEvent> create(const AtomicString& eventType, const double value) |
|
sof
2014/03/20 16:27:15
PassRefPtr<>
riju_
2014/03/20 20:12:29
Done.
|
| + { |
| + return adoptRefWillBeRefCountedGarbageCollected(new DeviceLightEvent(eventType, value)); |
|
sof
2014/03/20 16:27:15
adoptRef()
riju_
2014/03/20 20:12:29
Done.
|
| + } |
| + static PassRefPtrWillBeRawPtr<DeviceLightEvent> create(const AtomicString& eventType, const DeviceLightEventInit& initializer) |
|
sof
2014/03/20 16:27:15
PassRefPtr<>
riju_
2014/03/20 20:12:29
Done.
|
| + { |
| + return adoptRefWillBeRefCountedGarbageCollected(new DeviceLightEvent(eventType, initializer)); |
|
sof
2014/03/20 16:27:15
adoptRef()
riju_
2014/03/20 20:12:29
Done.
|
| + } |
| + |
| + double value() const { return m_value; } |
| + |
| + virtual const AtomicString& interfaceName() const OVERRIDE; |
| + |
| +private: |
| + DeviceLightEvent(); |
| + DeviceLightEvent(const AtomicString& eventType, const double value); |
| + DeviceLightEvent(const AtomicString& eventType, const DeviceLightEventInit& initializer); |
| + |
| + double m_value; |
| +}; |
| + |
| +DEFINE_TYPE_CASTS(DeviceLightEvent, Event, event, event->interfaceName() == EventNames::DeviceLightEvent, event.interfaceName() == EventNames::DeviceLightEvent); |
| + |
| +} // namespace WebCore |
| + |
| +#endif // DeviceLightEvent_h |