| 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/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 10 #include "core/page/Page.h" | 10 #include "core/page/Page.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 else | 42 else |
| 43 m_needsCheckingNullEvents = false; | 43 m_needsCheckingNullEvents = false; |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 void DeviceSingleWindowEventController::didAddEventListener(LocalDOMWindow* wind
ow, const AtomicString& eventType) | 47 void DeviceSingleWindowEventController::didAddEventListener(LocalDOMWindow* wind
ow, const AtomicString& eventType) |
| 48 { | 48 { |
| 49 if (eventType != eventTypeName()) | 49 if (eventType != eventTypeName()) |
| 50 return; | 50 return; |
| 51 | 51 |
| 52 if (page() && page()->visibilityState() == PageVisibilityStateVisible) | 52 if (page() && page()->isPageVisible()) |
| 53 startUpdating(); | 53 startUpdating(); |
| 54 | 54 |
| 55 m_hasEventListener = true; | 55 m_hasEventListener = true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void DeviceSingleWindowEventController::didRemoveEventListener(LocalDOMWindow* w
indow, const AtomicString& eventType) | 58 void DeviceSingleWindowEventController::didRemoveEventListener(LocalDOMWindow* w
indow, const AtomicString& eventType) |
| 59 { | 59 { |
| 60 if (eventType != eventTypeName() || window->hasEventListeners(eventTypeName(
))) | 60 if (eventType != eventTypeName() || window->hasEventListeners(eventTypeName(
))) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 stopUpdating(); | 63 stopUpdating(); |
| 64 m_hasEventListener = false; | 64 m_hasEventListener = false; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void DeviceSingleWindowEventController::didRemoveAllEventListeners(LocalDOMWindo
w*) | 67 void DeviceSingleWindowEventController::didRemoveAllEventListeners(LocalDOMWindo
w*) |
| 68 { | 68 { |
| 69 stopUpdating(); | 69 stopUpdating(); |
| 70 m_hasEventListener = false; | 70 m_hasEventListener = false; |
| 71 } | 71 } |
| 72 | 72 |
| 73 DEFINE_TRACE(DeviceSingleWindowEventController) | 73 DEFINE_TRACE(DeviceSingleWindowEventController) |
| 74 { | 74 { |
| 75 visitor->trace(m_document); | 75 visitor->trace(m_document); |
| 76 PlatformEventController::trace(visitor); | 76 PlatformEventController::trace(visitor); |
| 77 DOMWindowLifecycleObserver::trace(visitor); | 77 DOMWindowLifecycleObserver::trace(visitor); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace blink | 80 } // namespace blink |
| OLD | NEW |