| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Apple Inc. All rights reserved. | 2 * Copyright 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/frame/DOMWindow.h" | 31 #include "core/frame/DOMWindow.h" |
| 32 #include "core/page/Page.h" | 32 #include "core/page/Page.h" |
| 33 #include "modules/device_orientation/DeviceOrientationData.h" | 33 #include "modules/device_orientation/DeviceOrientationData.h" |
| 34 #include "modules/device_orientation/DeviceOrientationDispatcher.h" | 34 #include "modules/device_orientation/DeviceOrientationDispatcher.h" |
| 35 #include "modules/device_orientation/DeviceOrientationEvent.h" | 35 #include "modules/device_orientation/DeviceOrientationEvent.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 DeviceOrientationController::DeviceOrientationController(Document& document) | 39 DeviceOrientationController::DeviceOrientationController(Document& document) |
| 40 : DeviceSensorEventController(document) | 40 : DeviceSensorEventController(document.page()) |
| 41 , DOMWindowLifecycleObserver(document.domWindow()) | 41 , DOMWindowLifecycleObserver(document.domWindow()) |
| 42 , m_document(document) |
| 42 { | 43 { |
| 43 } | 44 } |
| 44 | 45 |
| 45 DeviceOrientationController::~DeviceOrientationController() | 46 DeviceOrientationController::~DeviceOrientationController() |
| 46 { | 47 { |
| 47 stopUpdating(); | 48 stopUpdating(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationDa
ta* deviceOrientationData) | 51 void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationDa
ta* deviceOrientationData) |
| 51 { | 52 { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 { | 94 { |
| 94 DeviceOrientationDispatcher::instance().removeDeviceOrientationController(th
is); | 95 DeviceOrientationDispatcher::instance().removeDeviceOrientationController(th
is); |
| 95 } | 96 } |
| 96 | 97 |
| 97 bool DeviceOrientationController::isNullEvent(Event* event) | 98 bool DeviceOrientationController::isNullEvent(Event* event) |
| 98 { | 99 { |
| 99 DeviceOrientationEvent* orientationEvent = toDeviceOrientationEvent(event); | 100 DeviceOrientationEvent* orientationEvent = toDeviceOrientationEvent(event); |
| 100 return !orientationEvent->orientation()->canProvideEventData(); | 101 return !orientationEvent->orientation()->canProvideEventData(); |
| 101 } | 102 } |
| 102 | 103 |
| 104 Document* DeviceOrientationController::document() |
| 105 { |
| 106 return &m_document; |
| 107 } |
| 108 |
| 103 void DeviceOrientationController::didAddEventListener(DOMWindow* window, const A
tomicString& eventType) | 109 void DeviceOrientationController::didAddEventListener(DOMWindow* window, const A
tomicString& eventType) |
| 104 { | 110 { |
| 105 if (eventType != EventTypeNames::deviceorientation) | 111 if (eventType != EventTypeNames::deviceorientation) |
| 106 return; | 112 return; |
| 107 | 113 |
| 108 if (page() && page()->visibilityState() == PageVisibilityStateVisible) | 114 if (page() && page()->visibilityState() == PageVisibilityStateVisible) |
| 109 startUpdating(); | 115 startUpdating(); |
| 110 | 116 |
| 111 m_hasEventListener = true; | 117 m_hasEventListener = true; |
| 112 } | 118 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 137 { | 143 { |
| 138 if (!m_overrideOrientationData) | 144 if (!m_overrideOrientationData) |
| 139 return; | 145 return; |
| 140 m_overrideOrientationData.clear(); | 146 m_overrideOrientationData.clear(); |
| 141 DeviceOrientationData* orientation = lastData(); | 147 DeviceOrientationData* orientation = lastData(); |
| 142 if (orientation) | 148 if (orientation) |
| 143 didChangeDeviceOrientation(orientation); | 149 didChangeDeviceOrientation(orientation); |
| 144 } | 150 } |
| 145 | 151 |
| 146 } // namespace WebCore | 152 } // namespace WebCore |
| OLD | NEW |