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

Side by Side Diff: Source/modules/device_orientation/DeviceMotionController.h

Issue 315573002: Generalize and refactor DeviceSensorEvent* architecture to support multi-event type targets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix override logic in DeviceOrientationController Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
tkent 2014/06/05 16:06:18 If you rewrote this file, please use the 3-line co
timvolodine 2014/06/05 17:29:04 Done.
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 */
26 30
27 #ifndef DeviceMotionController_h 31 #ifndef DeviceMotionController_h
28 #define DeviceMotionController_h 32 #define DeviceMotionController_h
29 33
30 #include "core/dom/DocumentSupplementable.h" 34 #include "core/dom/DocumentSupplementable.h"
31 #include "core/frame/DOMWindowLifecycleObserver.h" 35 #include "core/frame/DeviceSingleWindowEventController.h"
32 #include "core/frame/DeviceSensorEventController.h"
33 #include "modules/EventModules.h"
34 36
35 namespace WebCore { 37 namespace WebCore {
36 38
37 class DeviceMotionData; 39 class DeviceMotionData;
38 class DOMWindow; 40 class Event;
39 41
40 class DeviceMotionController FINAL : public NoBaseWillBeGarbageCollectedFinalize d<DeviceMotionController>, public DeviceSensorEventController, public DocumentSu pplement, public DOMWindowLifecycleObserver { 42 class DeviceMotionController FINAL : public NoBaseWillBeGarbageCollectedFinalize d<DeviceMotionController>, public DeviceSingleWindowEventController, public Docu mentSupplement {
41 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DeviceMotionController); 43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DeviceMotionController);
42 public: 44 public:
43 virtual ~DeviceMotionController(); 45 virtual ~DeviceMotionController();
44 46
45 static const char* supplementName(); 47 static const char* supplementName();
46 static DeviceMotionController& from(Document&); 48 static DeviceMotionController& from(Document&);
47 49
48 void didChangeDeviceMotion(DeviceMotionData*);
49
50 private: 50 private:
51 explicit DeviceMotionController(Document&); 51 explicit DeviceMotionController(Document&);
52
53 // Inherited from DeviceEventControllerBase.
52 virtual void registerWithDispatcher() OVERRIDE; 54 virtual void registerWithDispatcher() OVERRIDE;
53 virtual void unregisterWithDispatcher() OVERRIDE; 55 virtual void unregisterWithDispatcher() OVERRIDE;
56 virtual bool hasLastData() OVERRIDE;
54 57
55 // Inherited from DOMWindowLifecycleObserver. 58 // Inherited from DeviceSingleWindowEventController.
56 virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE; 59 virtual PassRefPtrWillBeRawPtr<Event> lastEvent() const OVERRIDE;
57 virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRID E; 60 virtual const AtomicString& eventTypeName() const OVERRIDE;
58 virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE; 61 virtual bool isNullEvent(Event*) const OVERRIDE;
59
60 virtual bool hasLastData() OVERRIDE;
61 virtual PassRefPtrWillBeRawPtr<Event> getLastEvent() OVERRIDE;
62 virtual bool isNullEvent(Event*) OVERRIDE;
63 virtual Document* document() OVERRIDE;
64
65 Document& m_document;
66 }; 62 };
67 63
68 } // namespace WebCore 64 } // namespace WebCore
69 65
70 #endif // DeviceMotionController_h 66 #endif // DeviceMotionController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698