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 "core/frame/Frame.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 #include "platform/scroll/ScrollableArea.h" | 14 #include "platform/scroll/ScrollableArea.h" |
15 #include "wtf/Assertions.h" | 15 #include "wtf/Assertions.h" |
16 #include "wtf/Forward.h" | 16 #include "wtf/Forward.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 class ApplicationCache; | 20 class ApplicationCache; |
21 class BarProp; | 21 class BarProp; |
22 class CSSRuleList; | 22 class CSSRuleList; |
23 class CSSStyleDeclaration; | 23 class CSSStyleDeclaration; |
24 class CustomElementRegistry; | 24 class CustomElementRegistry; |
25 class DOMSelection; | 25 class DOMSelection; |
26 class DOMVisualViewport; | 26 class DOMVisualViewport; |
| 27 class DOMWrapperWorld; |
27 class Document; | 28 class Document; |
28 class Element; | 29 class Element; |
29 class External; | 30 class External; |
30 class FrameRequestCallback; | 31 class FrameRequestCallback; |
31 class History; | 32 class History; |
32 class IdleRequestCallback; | 33 class IdleRequestCallback; |
33 class IdleRequestOptions; | 34 class IdleRequestOptions; |
34 class Location; | 35 class Location; |
35 class LocalDOMWindow; | 36 class LocalDOMWindow; |
36 class MessageEvent; | 37 class MessageEvent; |
37 class MediaQueryList; | 38 class MediaQueryList; |
38 class Navigator; | 39 class Navigator; |
39 class Screen; | 40 class Screen; |
40 class ScriptState; | 41 class ScriptState; |
41 class ScrollToOptions; | 42 class ScrollToOptions; |
42 class SerializedScriptValue; | 43 class SerializedScriptValue; |
43 class StyleMedia; | 44 class StyleMedia; |
| 45 class WindowProxyManagerBase; |
44 | 46 |
45 class CORE_EXPORT DOMWindow : public EventTargetWithInlineData, | 47 class CORE_EXPORT DOMWindow : public EventTargetWithInlineData, |
46 public DOMWindowBase64 { | 48 public DOMWindowBase64 { |
47 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
48 | 50 |
49 public: | 51 public: |
50 ~DOMWindow() override; | 52 ~DOMWindow() override; |
51 | 53 |
52 Frame* frame() const { | 54 Frame* frame() const { |
53 // If the DOMWindow still has a frame reference, that frame must point | 55 // 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 | 56 // back to this DOMWindow: otherwise, it's easy to get into a situation |
55 // where script execution leaks between different DOMWindows. | 57 // where script execution leaks between different DOMWindows. |
56 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); | 58 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); |
57 return m_frame; | 59 return m_frame; |
58 } | 60 } |
59 | 61 |
| 62 v8::Local<v8::Object> globalProxy(DOMWrapperWorld&); |
| 63 |
60 // GarbageCollectedFinalized overrides: | 64 // GarbageCollectedFinalized overrides: |
61 DECLARE_VIRTUAL_TRACE(); | 65 DECLARE_VIRTUAL_TRACE(); |
62 | 66 |
63 virtual bool isLocalDOMWindow() const = 0; | 67 virtual bool isLocalDOMWindow() const = 0; |
64 virtual bool isRemoteDOMWindow() const = 0; | 68 virtual bool isRemoteDOMWindow() const = 0; |
65 | 69 |
66 // ScriptWrappable overrides: | 70 // ScriptWrappable overrides: |
67 v8::Local<v8::Object> wrap(v8::Isolate*, | 71 v8::Local<v8::Object> wrap(v8::Isolate*, |
68 v8::Local<v8::Object> creationContext) final; | 72 v8::Local<v8::Object> creationContext) final; |
69 v8::Local<v8::Object> associateWithWrapper( | 73 v8::Local<v8::Object> associateWithWrapper( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 115 |
112 virtual const AtomicString& name() const = 0; | 116 virtual const AtomicString& name() const = 0; |
113 virtual void setName(const AtomicString&) = 0; | 117 virtual void setName(const AtomicString&) = 0; |
114 | 118 |
115 virtual String status() const = 0; | 119 virtual String status() const = 0; |
116 virtual void setStatus(const String&) = 0; | 120 virtual void setStatus(const String&) = 0; |
117 virtual String defaultStatus() const = 0; | 121 virtual String defaultStatus() const = 0; |
118 virtual void setDefaultStatus(const String&) = 0; | 122 virtual void setDefaultStatus(const String&) = 0; |
119 | 123 |
120 // Self-referential attributes | 124 // Self-referential attributes |
121 v8::Local<v8::Object> self(ScriptState*) const; | 125 DOMWindow* self() { return this; } |
122 v8::Local<v8::Object> window(ScriptState* scriptState) const { | 126 DOMWindow* window() { return this; } |
123 return self(scriptState); | 127 DOMWindow* frames() { return this; } |
124 } | |
125 v8::Local<v8::Object> frames(ScriptState* scriptState) const { | |
126 return self(scriptState); | |
127 } | |
128 | 128 |
129 DOMWindow* opener() const; | 129 DOMWindow* opener() const; |
130 DOMWindow* parent() const; | 130 DOMWindow* parent(); |
131 DOMWindow* top() const; | 131 DOMWindow* top() const; |
132 | 132 |
133 // DOM Level 2 AbstractView Interface | 133 // DOM Level 2 AbstractView Interface |
134 virtual Document* document() const = 0; | 134 virtual Document* document() const = 0; |
135 | 135 |
136 // CSSOM View Module | 136 // CSSOM View Module |
137 virtual StyleMedia* styleMedia() const = 0; | 137 virtual StyleMedia* styleMedia() const = 0; |
138 | 138 |
139 // WebKit extensions | 139 // WebKit extensions |
140 virtual double devicePixelRatio() const = 0; | 140 virtual double devicePixelRatio() const = 0; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 explicit DOMWindow(Frame&); | 264 explicit DOMWindow(Frame&); |
265 | 265 |
266 virtual void schedulePostMessage(MessageEvent*, | 266 virtual void schedulePostMessage(MessageEvent*, |
267 PassRefPtr<SecurityOrigin> target, | 267 PassRefPtr<SecurityOrigin> target, |
268 Document* source) = 0; | 268 Document* source) = 0; |
269 | 269 |
270 void disconnectFromFrame() { m_frame = nullptr; } | 270 void disconnectFromFrame() { m_frame = nullptr; } |
271 | 271 |
272 private: | 272 private: |
273 Member<Frame> m_frame; | 273 Member<Frame> m_frame; |
| 274 const Member<WindowProxyManagerBase> m_windowProxyManager; |
274 mutable Member<Location> m_location; | 275 mutable Member<Location> m_location; |
275 | 276 |
276 // Set to true when close() has been called. Needed for | 277 // Set to true when close() has been called. Needed for |
277 // |window.closed| determinism; having it return 'true' | 278 // |window.closed| determinism; having it return 'true' |
278 // only after the layout widget's deferred window close | 279 // only after the layout widget's deferred window close |
279 // operation has been performed, exposes (confusing) | 280 // operation has been performed, exposes (confusing) |
280 // implementation details to scripts. | 281 // implementation details to scripts. |
281 bool m_windowIsClosing; | 282 bool m_windowIsClosing; |
282 | |
283 }; | 283 }; |
284 | 284 |
285 } // namespace blink | 285 } // namespace blink |
286 | 286 |
287 #endif // DOMWindow_h | 287 #endif // DOMWindow_h |
OLD | NEW |