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

Side by Side Diff: Source/modules/device_orientation/DeviceOrientationController.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 Ditto.
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 DeviceOrientationController_h 31 #ifndef DeviceOrientationController_h
28 #define DeviceOrientationController_h 32 #define DeviceOrientationController_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 DeviceOrientationData; 39 class DeviceOrientationData;
40 class Event;
38 41
39 class DeviceOrientationController FINAL : public NoBaseWillBeGarbageCollectedFin alized<DeviceOrientationController>, public DeviceSensorEventController, public DocumentSupplement, public DOMWindowLifecycleObserver { 42 class DeviceOrientationController FINAL : public NoBaseWillBeGarbageCollectedFin alized<DeviceOrientationController>, public DeviceSingleWindowEventController, p ublic DocumentSupplement {
40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DeviceOrientationController); 43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DeviceOrientationController);
41 public: 44 public:
42 virtual ~DeviceOrientationController(); 45 virtual ~DeviceOrientationController();
43 46
44 static const char* supplementName(); 47 static const char* supplementName();
45 static DeviceOrientationController& from(Document&); 48 static DeviceOrientationController& from(Document&);
46 49
47 void didChangeDeviceOrientation(DeviceOrientationData*); 50 // Inherited from DeviceSingleWindowEventController.
51 void didUpdateData() OVERRIDE;
52
48 void setOverride(DeviceOrientationData*); 53 void setOverride(DeviceOrientationData*);
49 void clearOverride(); 54 void clearOverride();
50 55
51 // Inherited from DOMWindowLifecycleObserver
52 virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE;
53 virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRID E;
54 virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE;
55
56 virtual void trace(Visitor*) OVERRIDE; 56 virtual void trace(Visitor*) OVERRIDE;
57 57
58 private: 58 private:
59 explicit DeviceOrientationController(Document&); 59 explicit DeviceOrientationController(Document&);
60
61 // Inherited from DeviceEventControllerBase.
60 virtual void registerWithDispatcher() OVERRIDE; 62 virtual void registerWithDispatcher() OVERRIDE;
61 virtual void unregisterWithDispatcher() OVERRIDE; 63 virtual void unregisterWithDispatcher() OVERRIDE;
64 virtual bool hasLastData() OVERRIDE;
62 65
63 DeviceOrientationData* lastData(); 66 // Inherited from DeviceSingleWindowEventController.
64 virtual bool hasLastData() OVERRIDE; 67 virtual PassRefPtrWillBeRawPtr<Event> lastEvent() const OVERRIDE;
65 virtual PassRefPtrWillBeRawPtr<Event> getLastEvent() OVERRIDE; 68 virtual const AtomicString& eventTypeName() const OVERRIDE;
66 virtual bool isNullEvent(Event*) OVERRIDE; 69 virtual bool isNullEvent(Event*) const OVERRIDE;
67 virtual Document* document() OVERRIDE; 70
71 DeviceOrientationData* lastData() const;
68 72
69 RefPtrWillBeMember<DeviceOrientationData> m_overrideOrientationData; 73 RefPtrWillBeMember<DeviceOrientationData> m_overrideOrientationData;
70 Document& m_document;
71 }; 74 };
72 75
73 } // namespace WebCore 76 } // namespace WebCore
74 77
75 #endif // DeviceOrientationController_h 78 #endif // DeviceOrientationController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698