| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/DeviceSingleWindowEventController.h" | 5 #include "core/frame/DeviceSingleWindowEventController.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
| 9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 DeviceSingleWindowEventController::DeviceSingleWindowEventController( | 13 DeviceSingleWindowEventController::DeviceSingleWindowEventController( |
| 14 Document& document) | 14 Document& document) |
| 15 : PlatformEventController(document.page()), | 15 : PlatformEventController(document.page()), |
| 16 m_needsCheckingNullEvents(true), | 16 m_needsCheckingNullEvents(true), |
| 17 m_document(document) { | 17 m_document(document) { |
| 18 document.domWindow()->registerEventListenerObserver(this); | 18 document.domWindow()->registerEventListenerObserver(this); |
| 19 } | 19 } |
| 20 | 20 |
| 21 DeviceSingleWindowEventController::~DeviceSingleWindowEventController() {} | 21 DeviceSingleWindowEventController::~DeviceSingleWindowEventController() {} |
| 22 | 22 |
| 23 void DeviceSingleWindowEventController::didUpdateData() { | 23 void DeviceSingleWindowEventController::didUpdateData() { |
| 24 dispatchDeviceEvent(lastEvent()); | 24 dispatchDeviceEvent(lastEvent()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void DeviceSingleWindowEventController::dispatchDeviceEvent(Event* event) { | 27 void DeviceSingleWindowEventController::dispatchDeviceEvent(Event* event) { |
| 28 if (!document().domWindow() || document().activeDOMObjectsAreSuspended() || | 28 if (!document().domWindow() || document().activeDOMObjectsAreSuspended() || |
| 29 document().activeDOMObjectsAreStopped()) | 29 document().isContextDestroyed()) |
| 30 return; | 30 return; |
| 31 | 31 |
| 32 document().domWindow()->dispatchEvent(event); | 32 document().domWindow()->dispatchEvent(event); |
| 33 | 33 |
| 34 if (m_needsCheckingNullEvents) { | 34 if (m_needsCheckingNullEvents) { |
| 35 if (isNullEvent(event)) | 35 if (isNullEvent(event)) |
| 36 stopUpdating(); | 36 stopUpdating(); |
| 37 else | 37 else |
| 38 m_needsCheckingNullEvents = false; | 38 m_needsCheckingNullEvents = false; |
| 39 } | 39 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 stopUpdating(); | 67 stopUpdating(); |
| 68 m_hasEventListener = false; | 68 m_hasEventListener = false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 DEFINE_TRACE(DeviceSingleWindowEventController) { | 71 DEFINE_TRACE(DeviceSingleWindowEventController) { |
| 72 visitor->trace(m_document); | 72 visitor->trace(m_document); |
| 73 PlatformEventController::trace(visitor); | 73 PlatformEventController::trace(visitor); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |