Chromium Code Reviews| 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 |