OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (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. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef LocalDOMWindow_h | 27 #ifndef LocalDOMWindow_h |
28 #define LocalDOMWindow_h | 28 #define LocalDOMWindow_h |
29 | 29 |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "core/events/EventTarget.h" | 31 #include "core/events/EventTarget.h" |
32 #include "core/frame/DOMWindow.h" | 32 #include "core/frame/DOMWindow.h" |
33 #include "core/frame/DOMWindowLifecycleNotifier.h" | |
34 #include "core/frame/DOMWindowLifecycleObserver.h" | |
35 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
36 #include "core/frame/LocalFrameLifecycleObserver.h" | 34 #include "core/frame/LocalFrameLifecycleObserver.h" |
37 #include "platform/Supplementable.h" | 35 #include "platform/Supplementable.h" |
38 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
39 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
40 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
41 #include <memory> | 39 #include <memory> |
42 | 40 |
43 namespace blink { | 41 namespace blink { |
44 | 42 |
(...skipping 13 matching lines...) Expand all Loading... |
58 class SourceLocation; | 56 class SourceLocation; |
59 class DOMVisualViewport; | 57 class DOMVisualViewport; |
60 | 58 |
61 enum PageshowEventPersistence { | 59 enum PageshowEventPersistence { |
62 PageshowEventNotPersisted = 0, | 60 PageshowEventNotPersisted = 0, |
63 PageshowEventPersisted = 1 | 61 PageshowEventPersisted = 1 |
64 }; | 62 }; |
65 | 63 |
66 // Note: if you're thinking of returning something DOM-related by reference, | 64 // Note: if you're thinking of returning something DOM-related by reference, |
67 // please ping dcheng@chromium.org first. You probably don't want to do that. | 65 // please ping dcheng@chromium.org first. You probably don't want to do that. |
68 class CORE_EXPORT LocalDOMWindow final : public DOMWindow, public Supplementable
<LocalDOMWindow>, public DOMWindowLifecycleNotifier { | 66 class CORE_EXPORT LocalDOMWindow final : public DOMWindow, public Supplementable
<LocalDOMWindow> { |
69 USING_GARBAGE_COLLECTED_MIXIN(LocalDOMWindow); | 67 USING_GARBAGE_COLLECTED_MIXIN(LocalDOMWindow); |
70 USING_PRE_FINALIZER(LocalDOMWindow, dispose); | 68 USING_PRE_FINALIZER(LocalDOMWindow, dispose); |
71 public: | 69 public: |
| 70 |
| 71 class CORE_EXPORT EventListenerObserver : public GarbageCollectedMixin { |
| 72 public: |
| 73 virtual void didAddEventListener(LocalDOMWindow*, const AtomicString&) =
0; |
| 74 virtual void didRemoveEventListener(LocalDOMWindow*, const AtomicString&
) = 0; |
| 75 virtual void didRemoveAllEventListeners(LocalDOMWindow*) = 0; |
| 76 }; |
| 77 |
72 static Document* createDocument(const String& mimeType, const DocumentInit&,
bool forceXHTML); | 78 static Document* createDocument(const String& mimeType, const DocumentInit&,
bool forceXHTML); |
73 static LocalDOMWindow* create(LocalFrame& frame) | 79 static LocalDOMWindow* create(LocalFrame& frame) |
74 { | 80 { |
75 return new LocalDOMWindow(frame); | 81 return new LocalDOMWindow(frame); |
76 } | 82 } |
77 | 83 |
78 ~LocalDOMWindow() override; | 84 ~LocalDOMWindow() override; |
79 | 85 |
80 DECLARE_VIRTUAL_TRACE(); | 86 DECLARE_VIRTUAL_TRACE(); |
81 | 87 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 int webkitRequestAnimationFrame(FrameRequestCallback*) override; | 151 int webkitRequestAnimationFrame(FrameRequestCallback*) override; |
146 void cancelAnimationFrame(int id) override; | 152 void cancelAnimationFrame(int id) override; |
147 int requestIdleCallback(IdleRequestCallback*, const IdleRequestOptions&) ove
rride; | 153 int requestIdleCallback(IdleRequestCallback*, const IdleRequestOptions&) ove
rride; |
148 void cancelIdleCallback(int id) override; | 154 void cancelIdleCallback(int id) override; |
149 CustomElementsRegistry* customElements(ScriptState*) const override; | 155 CustomElementsRegistry* customElements(ScriptState*) const override; |
150 CustomElementsRegistry* customElements() const; | 156 CustomElementsRegistry* customElements() const; |
151 | 157 |
152 void registerProperty(DOMWindowProperty*); | 158 void registerProperty(DOMWindowProperty*); |
153 void unregisterProperty(DOMWindowProperty*); | 159 void unregisterProperty(DOMWindowProperty*); |
154 | 160 |
| 161 void registerEventListenerObserver(EventListenerObserver*); |
| 162 |
155 void reset(); | 163 void reset(); |
156 | 164 |
157 unsigned pendingUnloadEventListeners() const; | 165 unsigned pendingUnloadEventListeners() const; |
158 | 166 |
159 bool allowPopUp(); // Call on first window, not target window. | 167 bool allowPopUp(); // Call on first window, not target window. |
160 static bool allowPopUp(LocalFrame& firstFrame); | 168 static bool allowPopUp(LocalFrame& firstFrame); |
161 | 169 |
162 Element* frameElement() const; | 170 Element* frameElement() const; |
163 | 171 |
164 DOMWindow* open(const String& urlString, const AtomicString& frameName, cons
t String& windowFeaturesString, | 172 DOMWindow* open(const String& urlString, const AtomicString& frameName, cons
t String& windowFeaturesString, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 260 |
253 String m_status; | 261 String m_status; |
254 String m_defaultStatus; | 262 String m_defaultStatus; |
255 | 263 |
256 mutable Member<ApplicationCache> m_applicationCache; | 264 mutable Member<ApplicationCache> m_applicationCache; |
257 | 265 |
258 Member<DOMWindowEventQueue> m_eventQueue; | 266 Member<DOMWindowEventQueue> m_eventQueue; |
259 RefPtr<SerializedScriptValue> m_pendingStateObject; | 267 RefPtr<SerializedScriptValue> m_pendingStateObject; |
260 | 268 |
261 HeapHashSet<Member<PostMessageTimer>> m_postMessageTimers; | 269 HeapHashSet<Member<PostMessageTimer>> m_postMessageTimers; |
| 270 HeapHashSet<WeakMember<EventListenerObserver>> m_eventListenerObservers; |
262 }; | 271 }; |
263 | 272 |
264 DEFINE_TYPE_CASTS(LocalDOMWindow, DOMWindow, x, x->isLocalDOMWindow(), x.isLocal
DOMWindow()); | 273 DEFINE_TYPE_CASTS(LocalDOMWindow, DOMWindow, x, x->isLocalDOMWindow(), x.isLocal
DOMWindow()); |
265 | 274 |
266 inline String LocalDOMWindow::status() const | 275 inline String LocalDOMWindow::status() const |
267 { | 276 { |
268 return m_status; | 277 return m_status; |
269 } | 278 } |
270 | 279 |
271 inline String LocalDOMWindow::defaultStatus() const | 280 inline String LocalDOMWindow::defaultStatus() const |
272 { | 281 { |
273 return m_defaultStatus; | 282 return m_defaultStatus; |
274 } | 283 } |
275 | 284 |
276 } // namespace blink | 285 } // namespace blink |
277 | 286 |
278 #endif // LocalDOMWindow_h | 287 #endif // LocalDOMWindow_h |
OLD | NEW |