Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.h

Issue 2668753006: Special-case LocalDOMWindow for same-origin access in bindings. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 #ifndef LocalDOMWindow_h 27 #ifndef LocalDOMWindow_h
28 #define LocalDOMWindow_h 28 #define LocalDOMWindow_h
29 29
30 #include "bindings/core/v8/TraceWrapperMember.h" 30 #include "bindings/core/v8/TraceWrapperMember.h"
31 #include "core/CoreExport.h" 31 #include "core/CoreExport.h"
32 #include "core/events/EventTarget.h" 32 #include "core/events/EventTarget.h"
33 #include "core/frame/DOMWindow.h" 33 #include "core/frame/DOMWindow.h"
34 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
35 #include "platform/Supplementable.h" 35 #include "platform/Supplementable.h"
36 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
37 #include "platform/scroll/ScrollableArea.h"
37 #include "wtf/Assertions.h" 38 #include "wtf/Assertions.h"
38 #include "wtf/Forward.h" 39 #include "wtf/Forward.h"
39 #include <memory> 40 #include <memory>
40 41
41 namespace blink { 42 namespace blink {
42 43
44 class ApplicationCache;
45 class BarProp;
46 class CSSRuleList;
47 class CSSStyleDeclaration;
43 class CustomElementRegistry; 48 class CustomElementRegistry;
49 class Document;
50 class DocumentInit;
51 class DOMSelection;
52 class DOMVisualViewport;
44 class DOMWindowEventQueue; 53 class DOMWindowEventQueue;
45 class DocumentInit; 54 class Element;
46 class EventQueue; 55 class EventQueue;
56 class External;
47 class FrameConsole; 57 class FrameConsole;
58 class FrameRequestCallback;
59 class History;
60 class IdleRequestCallback;
61 class IdleRequestOptions;
62 class MediaQueryList;
48 class MessageEvent; 63 class MessageEvent;
64 class Navigator;
49 class PostMessageTimer; 65 class PostMessageTimer;
66 class Screen;
67 class ScriptState;
68 class ScrollToOptions;
50 class SecurityOrigin; 69 class SecurityOrigin;
70 class SerializedScriptValue;
51 class SourceLocation; 71 class SourceLocation;
52 class DOMVisualViewport; 72 class StyleMedia;
53 73
54 enum PageshowEventPersistence { 74 enum PageshowEventPersistence {
55 PageshowEventNotPersisted = 0, 75 PageshowEventNotPersisted = 0,
56 PageshowEventPersisted = 1 76 PageshowEventPersisted = 1
57 }; 77 };
58 78
59 // Note: if you're thinking of returning something DOM-related by reference, 79 // Note: if you're thinking of returning something DOM-related by reference,
60 // please ping dcheng@chromium.org first. You probably don't want to do that. 80 // please ping dcheng@chromium.org first. You probably don't want to do that.
61 class CORE_EXPORT LocalDOMWindow final : public DOMWindow, 81 class CORE_EXPORT LocalDOMWindow final : public DOMWindow,
62 public Supplementable<LocalDOMWindow> { 82 public Supplementable<LocalDOMWindow> {
(...skipping 25 matching lines...) Expand all
88 108
89 Document* installNewDocument(const String& mimeType, 109 Document* installNewDocument(const String& mimeType,
90 const DocumentInit&, 110 const DocumentInit&,
91 bool forceXHTML = false); 111 bool forceXHTML = false);
92 112
93 // EventTarget overrides: 113 // EventTarget overrides:
94 ExecutionContext* getExecutionContext() const override; 114 ExecutionContext* getExecutionContext() const override;
95 const LocalDOMWindow* toLocalDOMWindow() const override; 115 const LocalDOMWindow* toLocalDOMWindow() const override;
96 LocalDOMWindow* toLocalDOMWindow() override; 116 LocalDOMWindow* toLocalDOMWindow() override;
97 117
98 // DOMWindow overrides: 118 // Same-origin DOM Level 0
99 Screen* screen() const override; 119 Screen* screen() const;
100 History* history() const override; 120 History* history() const;
101 BarProp* locationbar() const override; 121 BarProp* locationbar() const;
102 BarProp* menubar() const override; 122 BarProp* menubar() const;
103 BarProp* personalbar() const override; 123 BarProp* personalbar() const;
104 BarProp* scrollbars() const override; 124 BarProp* scrollbars() const;
105 BarProp* statusbar() const override; 125 BarProp* statusbar() const;
106 BarProp* toolbar() const override; 126 BarProp* toolbar() const;
107 Navigator* navigator() const override; 127 Navigator* navigator() const;
108 bool offscreenBuffering() const override; 128 Navigator* clientInformation() const { return navigator(); }
109 int outerHeight() const override; 129
110 int outerWidth() const override; 130 bool offscreenBuffering() const;
111 int innerHeight() const override; 131
112 int innerWidth() const override; 132 int outerHeight() const;
113 int screenX() const override; 133 int outerWidth() const;
114 int screenY() const override; 134 int innerHeight() const;
115 double scrollX() const override; 135 int innerWidth() const;
116 double scrollY() const override; 136 int screenX() const;
117 DOMVisualViewport* visualViewport() override; 137 int screenY() const;
118 const AtomicString& name() const override; 138 int screenLeft() const { return screenX(); }
119 void setName(const AtomicString&) override; 139 int screenTop() const { return screenY(); }
120 String status() const override; 140 double scrollX() const;
121 void setStatus(const String&) override; 141 double scrollY() const;
122 String defaultStatus() const override; 142 double pageXOffset() const { return scrollX(); }
123 void setDefaultStatus(const String&) override; 143 double pageYOffset() const { return scrollY(); }
124 Document* document() const override; 144
125 StyleMedia* styleMedia() const override; 145 DOMVisualViewport* visualViewport();
126 double devicePixelRatio() const override; 146
127 ApplicationCache* applicationCache() const override; 147 const AtomicString& name() const;
128 int orientation() const override; 148 void setName(const AtomicString&);
129 DOMSelection* getSelection() override; 149
150 String status() const;
151 void setStatus(const String&);
152 String defaultStatus() const;
153 void setDefaultStatus(const String&);
154
155 // DOM Level 2 AbstractView Interface
156 Document* document() const;
157
158 // CSSOM View Module
159 StyleMedia* styleMedia() const;
160
161 // WebKit extensions
162 double devicePixelRatio() const;
163
164 ApplicationCache* applicationCache() const;
165
166 // This is the interface orientation in degrees. Some examples are:
167 // 0 is straight up; -90 is when the device is rotated 90 clockwise;
168 // 90 is when rotated counter clockwise.
169 int orientation() const;
170
171 DOMSelection* getSelection();
172
130 void blur() override; 173 void blur() override;
131 void print(ScriptState*) override; 174 void print(ScriptState*);
132 void stop() override; 175 void stop();
133 void alert(ScriptState*, const String& message = String()) override; 176
134 bool confirm(ScriptState*, const String& message) override; 177 void alert(ScriptState*, const String& message = String());
178 bool confirm(ScriptState*, const String& message);
135 String prompt(ScriptState*, 179 String prompt(ScriptState*,
136 const String& message, 180 const String& message,
137 const String& defaultValue) override; 181 const String& defaultValue);
182
138 bool find(const String&, 183 bool find(const String&,
139 bool caseSensitive, 184 bool caseSensitive,
140 bool backwards, 185 bool backwards,
141 bool wrap, 186 bool wrap,
142 bool wholeWord, 187 bool wholeWord,
143 bool searchInFrames, 188 bool searchInFrames,
144 bool showDialog) const override; 189 bool showDialog) const;
145 190
146 // FIXME: ScrollBehaviorSmooth is currently unsupported in VisualViewport. 191 // FIXME: ScrollBehaviorSmooth is currently unsupported in VisualViewport.
147 // crbug.com/434497 192 // crbug.com/434497
148 void scrollBy(double x, 193 void scrollBy(double x, double y, ScrollBehavior = ScrollBehaviorAuto) const;
149 double y, 194 void scrollBy(const ScrollToOptions&) const;
150 ScrollBehavior = ScrollBehaviorAuto) const override; 195 void scrollTo(double x, double y) const;
151 void scrollBy(const ScrollToOptions&) const override; 196 void scrollTo(const ScrollToOptions&) const;
152 void scrollTo(double x, double y) const override; 197 void scroll(double x, double y) const { scrollTo(x, y); }
153 void scrollTo(const ScrollToOptions&) const override; 198 void scroll(const ScrollToOptions& scrollToOptions) const {
199 scrollTo(scrollToOptions);
200 }
201 void moveBy(int x, int y) const;
202 void moveTo(int x, int y) const;
154 203
155 void moveBy(int x, int y) const override; 204 void resizeBy(int x, int y) const;
156 void moveTo(int x, int y) const override; 205 void resizeTo(int width, int height) const;
157 void resizeBy(int x, int y) const override; 206
158 void resizeTo(int width, int height) const override; 207 MediaQueryList* matchMedia(const String&);
159 MediaQueryList* matchMedia(const String&) override; 208
209 // DOM Level 2 Style Interface
160 CSSStyleDeclaration* getComputedStyle(Element*, 210 CSSStyleDeclaration* getComputedStyle(Element*,
161 const String& pseudoElt) const override; 211 const String& pseudoElt) const;
162 CSSRuleList* getMatchedCSSRules(Element*, 212
163 const String& pseudoElt) const override; 213 // WebKit extension
164 int requestAnimationFrame(FrameRequestCallback*) override; 214 CSSRuleList* getMatchedCSSRules(Element*, const String& pseudoElt) const;
165 int webkitRequestAnimationFrame(FrameRequestCallback*) override; 215
166 void cancelAnimationFrame(int id) override; 216 // WebKit animation extensions
167 int requestIdleCallback(IdleRequestCallback*, 217 int requestAnimationFrame(FrameRequestCallback*);
168 const IdleRequestOptions&) override; 218 int webkitRequestAnimationFrame(FrameRequestCallback*);
169 void cancelIdleCallback(int id) override; 219 void cancelAnimationFrame(int id);
170 CustomElementRegistry* customElements(ScriptState*) const override; 220
221 // Idle callback extensions
222 int requestIdleCallback(IdleRequestCallback*, const IdleRequestOptions&);
223 void cancelIdleCallback(int id);
224
225 // Custom elements
226 CustomElementRegistry* customElements(ScriptState*) const;
171 CustomElementRegistry* customElements() const; 227 CustomElementRegistry* customElements() const;
172 CustomElementRegistry* maybeCustomElements() const; 228 CustomElementRegistry* maybeCustomElements() const;
173 229
230 // Obsolete APIs
231 void captureEvents() {}
232 void releaseEvents() {}
233 External* external() const;
234
235 bool isSecureContext() const;
236
237 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend);
238 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration);
239 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart);
240 DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
241 DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend);
242 DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel);
243
244 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart,
245 webkitAnimationStart);
246 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration,
247 webkitAnimationIteration);
248 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend,
249 webkitAnimationEnd);
250 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend,
251 webkitTransitionEnd);
252
253 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange);
254
174 void registerEventListenerObserver(EventListenerObserver*); 255 void registerEventListenerObserver(EventListenerObserver*);
175 256
176 void frameDestroyed(); 257 void frameDestroyed();
177 void reset(); 258 void reset();
178 259
179 unsigned pendingUnloadEventListeners() const; 260 unsigned pendingUnloadEventListeners() const;
180 261
181 bool allowPopUp(); // Call on first window, not target window. 262 bool allowPopUp(); // Call on first window, not target window.
182 static bool allowPopUp(LocalFrame& firstFrame); 263 static bool allowPopUp(LocalFrame& firstFrame);
183 264
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 return m_status; 378 return m_status;
298 } 379 }
299 380
300 inline String LocalDOMWindow::defaultStatus() const { 381 inline String LocalDOMWindow::defaultStatus() const {
301 return m_defaultStatus; 382 return m_defaultStatus;
302 } 383 }
303 384
304 } // namespace blink 385 } // namespace blink
305 386
306 #endif // LocalDOMWindow_h 387 #endif // LocalDOMWindow_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698