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 "core/events/EventTarget.h" | 8 #include "core/events/EventTarget.h" |
9 #include "core/frame/DOMWindowBase64.h" | 9 #include "core/frame/DOMWindowBase64.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 #include "platform/scroll/ScrollableArea.h" | 11 #include "platform/scroll/ScrollableArea.h" |
12 | 12 |
13 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class ApplicationCache; | 17 class ApplicationCache; |
18 class BarProp; | 18 class BarProp; |
19 class CSSRuleList; | 19 class CSSRuleList; |
20 class CSSStyleDeclaration; | 20 class CSSStyleDeclaration; |
21 class Console; | 21 class Console; |
22 class DOMSelection; | 22 class DOMSelection; |
23 class DOMWindowCSS; | 23 class DOMWindowCSS; |
24 class DOMWindowProperty; | |
24 class Document; | 25 class Document; |
25 class Element; | 26 class Element; |
26 class Frame; | 27 class Frame; |
27 class History; | 28 class History; |
28 class LocalDOMWindow; | 29 class LocalDOMWindow; |
29 class Location; | 30 class Location; |
30 class MediaQueryList; | 31 class MediaQueryList; |
31 class Navigator; | 32 class Navigator; |
32 class Performance; | 33 class Performance; |
33 class RequestAnimationFrameCallback; | 34 class RequestAnimationFrameCallback; |
34 class Screen; | 35 class Screen; |
35 class ScrollToOptions; | 36 class ScrollToOptions; |
36 class SerializedScriptValue; | 37 class SerializedScriptValue; |
37 class Storage; | 38 class Storage; |
38 class StyleMedia; | 39 class StyleMedia; |
39 | 40 |
40 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray; | 41 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray; |
41 | 42 |
42 class DOMWindow : public EventTargetWithInlineData, public RefCountedWillBeNoBas e<DOMWindow>, public DOMWindowBase64 { | 43 class DOMWindow : public EventTargetWithInlineData, public RefCountedWillBeNoBas e<DOMWindow>, public DOMWindowBase64 { |
43 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
44 REFCOUNTED_EVENT_TARGET(DOMWindow); | 45 REFCOUNTED_EVENT_TARGET(DOMWindow); |
45 public: | 46 public: |
47 virtual ~DOMWindow(); | |
48 | |
46 // RefCountedWillBeGarbageCollectedFinalized overrides: | 49 // RefCountedWillBeGarbageCollectedFinalized overrides: |
47 void trace(Visitor* visitor) override | 50 void trace(Visitor* visitor) override |
48 { | 51 { |
dcheng
2015/02/02 19:27:52
+haraken, is there a threshhold that it's preferab
| |
49 EventTargetWithInlineData::trace(visitor); | 52 EventTargetWithInlineData::trace(visitor); |
53 visitor->trace(m_location); | |
50 } | 54 } |
51 | 55 |
52 virtual bool isLocalDOMWindow() const { return false; } | 56 virtual bool isLocalDOMWindow() const { return false; } |
53 virtual bool isRemoteDOMWindow() const { return false; } | 57 virtual bool isRemoteDOMWindow() const { return false; } |
54 | 58 |
55 virtual Frame* frame() const = 0; | 59 virtual Frame* frame() const = 0; |
56 | 60 |
57 // DOM Level 0 | 61 // DOM Level 0 |
58 virtual Screen* screen() const = 0; | 62 virtual Screen* screen() const = 0; |
59 virtual History* history() const = 0; | 63 virtual History* history() const = 0; |
60 virtual BarProp* locationbar() const = 0; | 64 virtual BarProp* locationbar() const = 0; |
61 virtual BarProp* menubar() const = 0; | 65 virtual BarProp* menubar() const = 0; |
62 virtual BarProp* personalbar() const = 0; | 66 virtual BarProp* personalbar() const = 0; |
63 virtual BarProp* scrollbars() const = 0; | 67 virtual BarProp* scrollbars() const = 0; |
64 virtual BarProp* statusbar() const = 0; | 68 virtual BarProp* statusbar() const = 0; |
65 virtual BarProp* toolbar() const = 0; | 69 virtual BarProp* toolbar() const = 0; |
66 virtual Navigator* navigator() const = 0; | 70 virtual Navigator* navigator() const = 0; |
67 Navigator* clientInformation() const { return navigator(); } | 71 Navigator* clientInformation() const { return navigator(); } |
68 // FIXME: Temporary, until window.location is implemented for remote frames. | 72 Location* location() const; |
69 virtual Location* location() const = 0; | |
70 | 73 |
71 virtual bool offscreenBuffering() const = 0; | 74 virtual bool offscreenBuffering() const = 0; |
72 | 75 |
73 virtual int outerHeight() const = 0; | 76 virtual int outerHeight() const = 0; |
74 virtual int outerWidth() const = 0; | 77 virtual int outerWidth() const = 0; |
75 virtual int innerHeight() const = 0; | 78 virtual int innerHeight() const = 0; |
76 virtual int innerWidth() const = 0; | 79 virtual int innerWidth() const = 0; |
77 virtual int screenX() const = 0; | 80 virtual int screenX() const = 0; |
78 virtual int screenY() const = 0; | 81 virtual int screenY() const = 0; |
79 int screenLeft() const { return screenX(); } | 82 int screenLeft() const { return screenX(); } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 virtual String crossDomainAccessErrorMessage(LocalDOMWindow* callingWindow) = 0; | 186 virtual String crossDomainAccessErrorMessage(LocalDOMWindow* callingWindow) = 0; |
184 virtual bool isInsecureScriptAccess(DOMWindow& callingWindow, const String& urlString); | 187 virtual bool isInsecureScriptAccess(DOMWindow& callingWindow, const String& urlString); |
185 | 188 |
186 // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., | 189 // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., |
187 // when its document is no longer the document that is displayed in its | 190 // when its document is no longer the document that is displayed in its |
188 // frame), we would like to zero out m_frame to avoid being confused | 191 // frame), we would like to zero out m_frame to avoid being confused |
189 // by the document that is currently active in m_frame. | 192 // by the document that is currently active in m_frame. |
190 // See https://bugs.webkit.org/show_bug.cgi?id=62054 | 193 // See https://bugs.webkit.org/show_bug.cgi?id=62054 |
191 bool isCurrentlyDisplayedInFrame() const; | 194 bool isCurrentlyDisplayedInFrame() const; |
192 | 195 |
196 virtual void reset(); | |
197 | |
198 void registerProperty(DOMWindowProperty*); | |
199 void unregisterProperty(DOMWindowProperty*); | |
200 void willDestroyDocumentInFrame(); | |
201 void willDetachDocumentFromFrame(); | |
202 | |
193 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend); | 203 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend); |
194 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration); | 204 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration); |
195 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart); | 205 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart); |
196 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); | 206 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); |
197 DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend); | 207 DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend); |
198 DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel); | 208 DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel); |
199 | 209 |
200 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimation Start); | 210 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimation Start); |
201 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnima tionIteration); | 211 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnima tionIteration); |
202 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEn d); | 212 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEn d); |
203 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransition End); | 213 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransition End); |
204 | 214 |
205 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); | 215 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
206 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); | 216 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); |
207 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); | 217 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); |
208 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); | 218 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); |
209 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); | 219 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); |
220 | |
221 private: | |
222 | |
dcheng
2015/02/02 19:27:52
Nit: remove blank line.
| |
223 WillBeHeapHashSet<RawPtrWillBeWeakMember<DOMWindowProperty>> m_properties; | |
224 mutable RefPtrWillBeMember<Location> m_location; | |
210 }; | 225 }; |
211 | 226 |
212 } // namespace blink | 227 } // namespace blink |
213 | 228 |
214 #endif // DOMWindow_h | 229 #endif // DOMWindow_h |
OLD | NEW |