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

Unified Diff: Source/modules/devicelight/DeviceLightEvent.h

Issue 143823004: Implement DeviceLight (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: DeviceLight API working fine (make the flag back to status=experimental) Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/devicelight/DeviceLightEvent.h
diff --git a/Source/modules/device_orientation/DeviceOrientationEvent.h b/Source/modules/devicelight/DeviceLightEvent.h
similarity index 52%
copy from Source/modules/device_orientation/DeviceOrientationEvent.h
copy to Source/modules/devicelight/DeviceLightEvent.h
index 243f5c220039e322c1fb41cfb94bc043028e0b2f..a3b68d7c0eb15600d719bf7c8fbdb18669388211 100644
--- a/Source/modules/device_orientation/DeviceOrientationEvent.h
+++ b/Source/modules/devicelight/DeviceLightEvent.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2010, The Android Open Source Project
+ * Copyright (C) 2014 Intel Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,50 +23,56 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DeviceOrientationEvent_h
-#define DeviceOrientationEvent_h
+#ifndef DeviceLightEvent_h
+#define DeviceLightEvent_h
#include "core/events/Event.h"
#include "heap/Handle.h"
namespace WebCore {
-class DeviceOrientationData;
+struct DeviceLightEventInit : public EventInit {
+ DeviceLightEventInit()
+ : value(std::numeric_limits<double>::infinity())
+ {
+ bubbles = true;
+ };
+
+ double value;
+};
-class DeviceOrientationEvent FINAL : public Event {
+class DeviceLightEvent FINAL : public Event {
public:
- virtual ~DeviceOrientationEvent();
- static PassRefPtr<DeviceOrientationEvent> create()
+ virtual ~DeviceLightEvent();
+
+ static PassRefPtrWillBeRawPtr<DeviceLightEvent> create()
{
- return adoptRef(new DeviceOrientationEvent);
+ return adoptRefWillBeRefCountedGarbageCollected(new DeviceLightEvent);
}
- static PassRefPtr<DeviceOrientationEvent> create(const AtomicString& eventType, DeviceOrientationData* orientation)
+ static PassRefPtrWillBeRawPtr<DeviceLightEvent> create(const AtomicString& eventType, const double value)
{
- return adoptRef(new DeviceOrientationEvent(eventType, orientation));
+ return adoptRefWillBeRefCountedGarbageCollected(new DeviceLightEvent(eventType, value));
+ }
+ static PassRefPtrWillBeRawPtr<DeviceLightEvent> create(const AtomicString& eventType, const DeviceLightEventInit& initializer)
+ {
+ return adoptRefWillBeRefCountedGarbageCollected(new DeviceLightEvent(eventType, initializer));
}
- void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData*);
-
- DeviceOrientationData* orientation() const { return m_orientation.get(); }
-
- double alpha(bool& isNull) const;
- double beta(bool& isNull) const;
- double gamma(bool& isNull) const;
- bool absolute(bool& isNull) const;
+ double value() const { return m_value; }
virtual const AtomicString& interfaceName() const OVERRIDE;
-
virtual void trace(Visitor*) OVERRIDE;
private:
- DeviceOrientationEvent();
- DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientationData*);
+ DeviceLightEvent();
+ DeviceLightEvent(const AtomicString& eventType, const double value);
+ DeviceLightEvent(const AtomicString& eventType, const DeviceLightEventInit& initializer);
- RefPtrWillBeMember<DeviceOrientationData> m_orientation;
+ double m_value;
};
-DEFINE_TYPE_CASTS(DeviceOrientationEvent, Event, event, event->interfaceName() == EventNames::DeviceOrientationEvent, event.interfaceName() == EventNames::DeviceOrientationEvent);
+DEFINE_TYPE_CASTS(DeviceLightEvent, Event, event, event->interfaceName() == EventNames::DeviceLightEvent, event.interfaceName() == EventNames::DeviceLightEvent);
} // namespace WebCore
-#endif // DeviceOrientationEvent_h
+#endif // DeviceLightEvent_h

Powered by Google App Engine
This is Rietveld 408576698