| 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 #ifndef DOMWindow_h | 5 #ifndef DOMWindow_h |
| 6 #define DOMWindow_h | 6 #define DOMWindow_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/Transferables.h" | 8 #include "bindings/core/v8/Transferables.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| 11 #include "core/frame/DOMWindowBase64.h" | 11 #include "core/frame/DOMWindowBase64.h" |
| 12 #include "core/frame/Frame.h" |
| 12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 13 #include "platform/scroll/ScrollableArea.h" | 14 #include "platform/scroll/ScrollableArea.h" |
| 14 | 15 #include "wtf/Assertions.h" |
| 15 #include "wtf/Forward.h" | 16 #include "wtf/Forward.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 class ApplicationCache; | 20 class ApplicationCache; |
| 20 class BarProp; | 21 class BarProp; |
| 21 class CSSRuleList; | 22 class CSSRuleList; |
| 22 class CSSStyleDeclaration; | 23 class CSSStyleDeclaration; |
| 23 class CustomElementRegistry; | 24 class CustomElementRegistry; |
| 24 class DOMSelection; | 25 class DOMSelection; |
| 25 class DOMVisualViewport; | 26 class DOMVisualViewport; |
| 26 class Document; | 27 class Document; |
| 27 class Element; | 28 class Element; |
| 28 class External; | 29 class External; |
| 29 class Frame; | |
| 30 class FrameRequestCallback; | 30 class FrameRequestCallback; |
| 31 class History; | 31 class History; |
| 32 class IdleRequestCallback; | 32 class IdleRequestCallback; |
| 33 class IdleRequestOptions; | 33 class IdleRequestOptions; |
| 34 class Location; | 34 class Location; |
| 35 class LocalDOMWindow; | 35 class LocalDOMWindow; |
| 36 class MessageEvent; | 36 class MessageEvent; |
| 37 class MediaQueryList; | 37 class MediaQueryList; |
| 38 class Navigator; | 38 class Navigator; |
| 39 class Screen; | 39 class Screen; |
| 40 class ScriptState; | 40 class ScriptState; |
| 41 class ScrollToOptions; | 41 class ScrollToOptions; |
| 42 class SerializedScriptValue; | 42 class SerializedScriptValue; |
| 43 class StyleMedia; | 43 class StyleMedia; |
| 44 | 44 |
| 45 class CORE_EXPORT DOMWindow : public EventTargetWithInlineData, | 45 class CORE_EXPORT DOMWindow : public EventTargetWithInlineData, |
| 46 public DOMWindowBase64 { | 46 public DOMWindowBase64 { |
| 47 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
| 48 | 48 |
| 49 public: | 49 public: |
| 50 ~DOMWindow() override; | 50 ~DOMWindow() override; |
| 51 | 51 |
| 52 Frame* frame() const { |
| 53 // If the DOMWindow still has a frame reference, that frame must point |
| 54 // back to this DOMWindow: otherwise, it's easy to get into a situation |
| 55 // where script execution leaks between different DOMWindows. |
| 56 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); |
| 57 return m_frame; |
| 58 } |
| 59 |
| 52 // GarbageCollectedFinalized overrides: | 60 // GarbageCollectedFinalized overrides: |
| 53 DECLARE_VIRTUAL_TRACE(); | 61 DECLARE_VIRTUAL_TRACE(); |
| 54 | 62 |
| 55 virtual bool isLocalDOMWindow() const = 0; | 63 virtual bool isLocalDOMWindow() const = 0; |
| 56 virtual bool isRemoteDOMWindow() const = 0; | 64 virtual bool isRemoteDOMWindow() const = 0; |
| 57 | 65 |
| 58 virtual Frame* frame() const = 0; | |
| 59 | |
| 60 // ScriptWrappable overrides: | 66 // ScriptWrappable overrides: |
| 61 v8::Local<v8::Object> wrap(v8::Isolate*, | 67 v8::Local<v8::Object> wrap(v8::Isolate*, |
| 62 v8::Local<v8::Object> creationContext) final; | 68 v8::Local<v8::Object> creationContext) final; |
| 63 v8::Local<v8::Object> associateWithWrapper( | 69 v8::Local<v8::Object> associateWithWrapper( |
| 64 v8::Isolate*, | 70 v8::Isolate*, |
| 65 const WrapperTypeInfo*, | 71 const WrapperTypeInfo*, |
| 66 v8::Local<v8::Object> wrapper) final; | 72 v8::Local<v8::Object> wrapper) final; |
| 67 | 73 |
| 68 // EventTarget overrides: | 74 // EventTarget overrides: |
| 69 const AtomicString& interfaceName() const override; | 75 const AtomicString& interfaceName() const override; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, | 254 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, |
| 249 webkitAnimationIteration); | 255 webkitAnimationIteration); |
| 250 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, | 256 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, |
| 251 webkitAnimationEnd); | 257 webkitAnimationEnd); |
| 252 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, | 258 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, |
| 253 webkitTransitionEnd); | 259 webkitTransitionEnd); |
| 254 | 260 |
| 255 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); | 261 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
| 256 | 262 |
| 257 protected: | 263 protected: |
| 258 DOMWindow(); | 264 explicit DOMWindow(Frame&); |
| 259 | 265 |
| 260 virtual void schedulePostMessage(MessageEvent*, | 266 virtual void schedulePostMessage(MessageEvent*, |
| 261 PassRefPtr<SecurityOrigin> target, | 267 PassRefPtr<SecurityOrigin> target, |
| 262 Document* source) = 0; | 268 Document* source) = 0; |
| 263 | 269 |
| 270 void disconnectFromFrame() { m_frame = nullptr; } |
| 271 |
| 272 private: |
| 273 Member<Frame> m_frame; |
| 274 mutable Member<Location> m_location; |
| 275 |
| 264 // Set to true when close() has been called. Needed for | 276 // Set to true when close() has been called. Needed for |
| 265 // |window.closed| determinism; having it return 'true' | 277 // |window.closed| determinism; having it return 'true' |
| 266 // only after the layout widget's deferred window close | 278 // only after the layout widget's deferred window close |
| 267 // operation has been performed, exposes (confusing) | 279 // operation has been performed, exposes (confusing) |
| 268 // implementation details to scripts. | 280 // implementation details to scripts. |
| 269 bool m_windowIsClosing; | 281 bool m_windowIsClosing; |
| 270 | 282 |
| 271 private: | |
| 272 mutable Member<Location> m_location; | |
| 273 }; | 283 }; |
| 274 | 284 |
| 275 } // namespace blink | 285 } // namespace blink |
| 276 | 286 |
| 277 #endif // DOMWindow_h | 287 #endif // DOMWindow_h |
| OLD | NEW |