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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
4 * 3 *
5 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions are
7 * are met: 6 * met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 7 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 8 * * Redistributions of source code must retain the above copyright
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 9 * notice, this list of conditions and the following disclaimer.
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 10 * * Redistributions in binary form must reproduce the above
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 11 * copyright notice, this list of conditions and the following disclaimer
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 12 * in the documentation and/or other materials provided with the
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 13 * distribution.
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 14 * * Neither the name of Google Inc. nor the names of its
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 15 * contributors may be used to endorse or promote products derived from
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 29 */
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.
26 30
27 #ifndef DeviceMotionController_h 31 #ifndef DeviceMotionController_h
28 #define DeviceMotionController_h 32 #define DeviceMotionController_h
29 33
30 #include "DeviceController.h" 34 #include "DeviceController.h"
31 35
32 namespace WebCore { 36 namespace WebCore {
33 37
34 class DeviceMotionClient;
35 class DeviceMotionData; 38 class DeviceMotionData;
36 39
37 class DeviceMotionController : public DeviceController { 40 class DeviceMotionController : public DeviceController {
38 public: 41 public:
39 ~DeviceMotionController() { }; 42 virtual ~DeviceMotionController() { };
40 43
41 static PassOwnPtr<DeviceMotionController> create(DeviceMotionClient*); 44 static DeviceMotionController& shared();
42 45
43 void didChangeDeviceMotion(DeviceMotionData*); 46 void didChangeDeviceMotion(DeviceMotionData*);
44 DeviceMotionClient* deviceMotionClient();
45 47
46 virtual bool hasLastData() OVERRIDE; 48 virtual bool hasLastData() OVERRIDE;
47 virtual PassRefPtr<Event> getLastEvent() OVERRIDE; 49 virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
50 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
48 51
49 static const char* supplementName(); 52 virtual void startUpdating();
50 static DeviceMotionController* from(Page*); 53 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.
51 static bool isActiveAt(Page*);
52 54
53 private: 55 // -------------------------------------------------
Peter Beverloo 2013/04/09 17:29:53 nit: the horizontal line without explanation is a
timvolodine 2013/04/10 19:06:12 Done.
54 explicit DeviceMotionController(DeviceMotionClient*); 56
57 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
58 void removeDeviceEventListener(DOMWindow*) OVERRIDE;
59 void removeAllDeviceEventListeners(DOMWindow*) OVERRIDE;
60
61 // void dispatchDeviceEvent(PassRefPtr<Event>);
62 // bool isActive() { return !m_listeners.isEmpty(); }
63 // 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.
64
65 protected:
66 DeviceMotionController();
67 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.
55 }; 68 };
56 69
57 } // namespace WebCore 70 } // namespace WebCore
58 71
59 #endif // DeviceMotionController_h 72 #endif // DeviceMotionController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698