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

Unified Diff: Source/WebCore/dom/DeviceMotionController.h

Issue 13866007: WebKit & WebCore part of the device motion implementation using the platform layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@devicemotion-webcore
Patch Set: added new LICENSE header Created 7 years, 8 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/WebCore/dom/DeviceMotionController.h
diff --git a/Source/WebCore/dom/DeviceMotionController.h b/Source/WebCore/dom/DeviceMotionController.h
index 29bf913414a8aff01839a6dd4655401fc7cd2101..eac2313a72fb0337dd9e57d978d8c4d731fb8a1e 100644
--- a/Source/WebCore/dom/DeviceMotionController.h
+++ b/Source/WebCore/dom/DeviceMotionController.h
@@ -1,25 +1,29 @@
/*
- * Copyright 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * modification, are permitted provided that the following conditions are
+ * met:
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Peter Beverloo 2013/04/09 17:29:53 We can't just change the copyright header if Samsu
timvolodine 2013/04/10 19:06:12 Done.
@@ -31,27 +35,36 @@
namespace WebCore {
-class DeviceMotionClient;
class DeviceMotionData;
class DeviceMotionController : public DeviceController {
public:
- ~DeviceMotionController() { };
+ virtual ~DeviceMotionController() { };
- static PassOwnPtr<DeviceMotionController> create(DeviceMotionClient*);
+ static DeviceMotionController& shared();
void didChangeDeviceMotion(DeviceMotionData*);
- DeviceMotionClient* deviceMotionClient();
virtual bool hasLastData() OVERRIDE;
virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
+ bool isActiveAt(Page* page) { return m_activePages.contains(page); }
Peter Beverloo 2013/04/09 17:29:53 This class will now have both isActive() and isAct
timvolodine 2013/04/10 19:06:12 That's how it was before as well. DeviceController
+
+ virtual void startUpdating();
+ virtual void stopUpdating();
Peter Beverloo 2013/04/09 17:29:53 Why are these declared as virtual? Also, do they h
timvolodine 2013/04/10 19:06:12 Done.
+
+// -------------------------------------------------
Peter Beverloo 2013/04/09 17:29:53 nit: the horizontal line without explanation is a
timvolodine 2013/04/10 19:06:12 Done.
+
+ void addDeviceEventListener(DOMWindow*) OVERRIDE;
Peter Beverloo 2013/04/09 17:29:53 Why are these declared OVERRIDE without being decl
timvolodine 2013/04/10 19:06:12 right, yes the idea is to generalize the design on
+ void removeDeviceEventListener(DOMWindow*) OVERRIDE;
+ void removeAllDeviceEventListeners(DOMWindow*) OVERRIDE;
- static const char* supplementName();
- static DeviceMotionController* from(Page*);
- static bool isActiveAt(Page*);
+// void dispatchDeviceEvent(PassRefPtr<Event>);
+// bool isActive() { return !m_listeners.isEmpty(); }
+// DeviceClient* client() { return m_client; }
Peter Beverloo 2013/04/09 17:29:53 No commented-out code please.
timvolodine 2013/04/10 19:06:12 Done.
-private:
- explicit DeviceMotionController(DeviceMotionClient*);
+protected:
+ DeviceMotionController();
+ HashCountedSet<Page*> m_activePages;
Peter Beverloo 2013/04/09 17:29:53 nit: could you add an empty line between the const
timvolodine 2013/04/10 19:06:12 Done.
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698