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 "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 #include "platform/scroll/ScrollableArea.h" |
| 12 |
| 13 #include "wtf/Forward.h" |
10 | 14 |
11 namespace blink { | 15 namespace blink { |
12 | 16 |
13 class ApplicationCache; | 17 class ApplicationCache; |
14 class BarProp; | 18 class BarProp; |
| 19 class CSSRuleList; |
| 20 class CSSStyleDeclaration; |
15 class Console; | 21 class Console; |
| 22 class DOMSelection; |
16 class DOMWindowCSS; | 23 class DOMWindowCSS; |
17 class Document; | 24 class Document; |
| 25 class Element; |
18 class Frame; | 26 class Frame; |
19 class History; | 27 class History; |
20 class Location; | 28 class Location; |
| 29 class MediaQueryList; |
21 class Navigator; | 30 class Navigator; |
22 class Performance; | 31 class Performance; |
| 32 class RequestAnimationFrameCallback; |
23 class Screen; | 33 class Screen; |
| 34 class ScrollOptions; |
| 35 class SerializedScriptValue; |
24 class Storage; | 36 class Storage; |
25 class StyleMedia; | 37 class StyleMedia; |
26 | 38 |
27 class DOMWindow : public RefCountedWillBeGarbageCollectedFinalized<DOMWindow>, p
ublic EventTargetWithInlineData { | 39 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray; |
| 40 |
| 41 class DOMWindow : public RefCountedWillBeGarbageCollectedFinalized<DOMWindow>, p
ublic EventTargetWithInlineData, public DOMWindowBase64 { |
28 REFCOUNTED_EVENT_TARGET(DOMWindow); | 42 REFCOUNTED_EVENT_TARGET(DOMWindow); |
29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMWindow); | 43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMWindow); |
30 public: | 44 public: |
31 // RefCountedWillBeGarbageCollectedFinalized overrides: | 45 // RefCountedWillBeGarbageCollectedFinalized overrides: |
32 void trace(Visitor* visitor) override | 46 void trace(Visitor* visitor) override |
33 { | 47 { |
34 EventTargetWithInlineData::trace(visitor); | 48 EventTargetWithInlineData::trace(visitor); |
35 } | 49 } |
36 | 50 |
| 51 virtual bool isLocalDOMWindow() const { return false; } |
| 52 |
37 virtual Frame* frame() const = 0; | 53 virtual Frame* frame() const = 0; |
38 | 54 |
39 // DOM Level 0 | 55 // DOM Level 0 |
40 virtual Screen* screen() const = 0; | 56 virtual Screen* screen() const = 0; |
41 virtual History* history() const = 0; | 57 virtual History* history() const = 0; |
42 virtual BarProp* locationbar() const = 0; | 58 virtual BarProp* locationbar() const = 0; |
43 virtual BarProp* menubar() const = 0; | 59 virtual BarProp* menubar() const = 0; |
44 virtual BarProp* personalbar() const = 0; | 60 virtual BarProp* personalbar() const = 0; |
45 virtual BarProp* scrollbars() const = 0; | 61 virtual BarProp* scrollbars() const = 0; |
46 virtual BarProp* statusbar() const = 0; | 62 virtual BarProp* statusbar() const = 0; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // This is the interface orientation in degrees. Some examples are: | 118 // This is the interface orientation in degrees. Some examples are: |
103 // 0 is straight up; -90 is when the device is rotated 90 clockwise; | 119 // 0 is straight up; -90 is when the device is rotated 90 clockwise; |
104 // 90 is when rotated counter clockwise. | 120 // 90 is when rotated counter clockwise. |
105 virtual int orientation() const = 0; | 121 virtual int orientation() const = 0; |
106 | 122 |
107 virtual Console* console() const = 0; | 123 virtual Console* console() const = 0; |
108 | 124 |
109 virtual Performance* performance() const = 0; | 125 virtual Performance* performance() const = 0; |
110 | 126 |
111 virtual DOMWindowCSS* css() const = 0; | 127 virtual DOMWindowCSS* css() const = 0; |
| 128 |
| 129 virtual DOMSelection* getSelection() = 0; |
| 130 |
| 131 virtual void focus(ExecutionContext* = 0) = 0; |
| 132 virtual void blur() = 0; |
| 133 virtual void close(ExecutionContext* = 0) = 0; |
| 134 virtual void print() = 0; |
| 135 virtual void stop() = 0; |
| 136 |
| 137 virtual void alert(const String& message = String()) = 0; |
| 138 virtual bool confirm(const String& message) = 0; |
| 139 virtual String prompt(const String& message, const String& defaultValue) = 0
; |
| 140 |
| 141 virtual bool find(const String&, bool caseSensitive, bool backwards, bool wr
ap, bool wholeWord, bool searchInFrames, bool showDialog) const = 0; |
| 142 |
| 143 virtual void scrollBy(double x, double y, ScrollBehavior = ScrollBehaviorAut
o) const = 0; |
| 144 virtual void scrollBy(double x, double y, const ScrollOptions&, ExceptionSta
te&) const = 0; |
| 145 virtual void scrollTo(double x, double y, ScrollBehavior = ScrollBehaviorAut
o) const = 0; |
| 146 virtual void scrollTo(double x, double y, const ScrollOptions&, ExceptionSta
te&) const = 0; |
| 147 void scroll(double x, double y) const { scrollTo(x, y); } |
| 148 void scroll(double x, double y, const ScrollOptions& scrollOptions, Exceptio
nState& exceptionState) const { scrollTo(x, y, scrollOptions, exceptionState); } |
| 149 virtual void moveBy(float x, float y) const = 0; |
| 150 virtual void moveTo(float x, float y) const = 0; |
| 151 |
| 152 virtual void resizeBy(float x, float y) const = 0; |
| 153 virtual void resizeTo(float width, float height) const = 0; |
| 154 |
| 155 virtual PassRefPtrWillBeRawPtr<MediaQueryList> matchMedia(const String&) = 0
; |
| 156 |
| 157 // DOM Level 2 Style Interface |
| 158 virtual PassRefPtrWillBeRawPtr<CSSStyleDeclaration> getComputedStyle(Element
*, const String& pseudoElt) const = 0; |
| 159 |
| 160 // WebKit extensions |
| 161 virtual PassRefPtrWillBeRawPtr<CSSRuleList> getMatchedCSSRules(Element*, con
st String& pseudoElt) const = 0; |
| 162 |
| 163 // WebKit animation extensions |
| 164 virtual int requestAnimationFrame(RequestAnimationFrameCallback*) = 0; |
| 165 virtual int webkitRequestAnimationFrame(RequestAnimationFrameCallback*) = 0; |
| 166 virtual void cancelAnimationFrame(int id) = 0; |
| 167 |
| 168 void captureEvents() { } |
| 169 void releaseEvents() { } |
| 170 |
| 171 // FIXME: Should this be returning DOMWindows? |
| 172 virtual LocalDOMWindow* anonymousIndexedGetter(uint32_t) = 0; |
| 173 |
| 174 virtual void postMessage(PassRefPtr<SerializedScriptValue> message, const Me
ssagePortArray*, const String& targetOrigin, LocalDOMWindow* source, ExceptionSt
ate&) = 0; |
| 175 |
| 176 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend); |
| 177 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration); |
| 178 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart); |
| 179 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); |
| 180 DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend); |
| 181 DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel); |
| 182 |
| 183 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimation
Start); |
| 184 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnima
tionIteration); |
| 185 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEn
d); |
| 186 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransition
End); |
| 187 |
| 188 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
| 189 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); |
| 190 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); |
| 191 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); |
| 192 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); |
112 }; | 193 }; |
113 | 194 |
114 } // namespace blink | 195 } // namespace blink |
115 | 196 |
116 #endif // DOMWindow_h | 197 #endif // DOMWindow_h |
OLD | NEW |