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

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: Rebase and address comments. 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"
40
39 #include <memory> 41 #include <memory>
40 42
41 namespace blink { 43 namespace blink {
42 44
45 class ApplicationCache;
46 class BarProp;
47 class CSSRuleList;
48 class CSSStyleDeclaration;
43 class CustomElementRegistry; 49 class CustomElementRegistry;
50 class Document;
51 class DocumentInit;
52 class DOMSelection;
53 class DOMVisualViewport;
44 class DOMWindowEventQueue; 54 class DOMWindowEventQueue;
45 class DocumentInit; 55 class Element;
46 class EventQueue; 56 class EventQueue;
57 class External;
47 class FrameConsole; 58 class FrameConsole;
59 class FrameRequestCallback;
60 class History;
61 class IdleRequestCallback;
62 class IdleRequestOptions;
63 class MediaQueryList;
48 class MessageEvent; 64 class MessageEvent;
65 class Navigator;
49 class PostMessageTimer; 66 class PostMessageTimer;
67 class Screen;
68 class ScriptState;
69 class ScrollToOptions;
50 class SecurityOrigin; 70 class SecurityOrigin;
71 class SerializedScriptValue;
51 class SourceLocation; 72 class SourceLocation;
52 class DOMVisualViewport; 73 class StyleMedia;
53 74
54 enum PageshowEventPersistence { 75 enum PageshowEventPersistence {
55 PageshowEventNotPersisted = 0, 76 PageshowEventNotPersisted = 0,
56 PageshowEventPersisted = 1 77 PageshowEventPersisted = 1
57 }; 78 };
58 79
59 // Note: if you're thinking of returning something DOM-related by reference, 80 // 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. 81 // please ping dcheng@chromium.org first. You probably don't want to do that.
61 class CORE_EXPORT LocalDOMWindow final : public DOMWindow, 82 class CORE_EXPORT LocalDOMWindow final : public DOMWindow,
62 public Supplementable<LocalDOMWindow> { 83 public Supplementable<LocalDOMWindow> {
(...skipping 25 matching lines...) Expand all
88 109
89 Document* installNewDocument(const String& mimeType, 110 Document* installNewDocument(const String& mimeType,
90 const DocumentInit&, 111 const DocumentInit&,
91 bool forceXHTML = false); 112 bool forceXHTML = false);
92 113
93 // EventTarget overrides: 114 // EventTarget overrides:
94 ExecutionContext* getExecutionContext() const override; 115 ExecutionContext* getExecutionContext() const override;
95 const LocalDOMWindow* toLocalDOMWindow() const override; 116 const LocalDOMWindow* toLocalDOMWindow() const override;
96 LocalDOMWindow* toLocalDOMWindow() override; 117 LocalDOMWindow* toLocalDOMWindow() override;
97 118
98 // DOMWindow overrides: 119 // Same-origin DOM Level 0
99 Screen* screen() const override; 120 Screen* screen() const;
100 History* history() const override; 121 History* history() const;
101 BarProp* locationbar() const override; 122 BarProp* locationbar() const;
102 BarProp* menubar() const override; 123 BarProp* menubar() const;
103 BarProp* personalbar() const override; 124 BarProp* personalbar() const;
104 BarProp* scrollbars() const override; 125 BarProp* scrollbars() const;
105 BarProp* statusbar() const override; 126 BarProp* statusbar() const;
106 BarProp* toolbar() const override; 127 BarProp* toolbar() const;
107 Navigator* navigator() const override; 128 Navigator* navigator() const;
108 bool offscreenBuffering() const override; 129 Navigator* clientInformation() const { return navigator(); }
109 int outerHeight() const override; 130
110 int outerWidth() const override; 131 bool offscreenBuffering() const;
111 int innerHeight() const override; 132
112 int innerWidth() const override; 133 int outerHeight() const;
113 int screenX() const override; 134 int outerWidth() const;
114 int screenY() const override; 135 int innerHeight() const;
115 double scrollX() const override; 136 int innerWidth() const;
116 double scrollY() const override; 137 int screenX() const;
117 DOMVisualViewport* visualViewport() override; 138 int screenY() const;
118 const AtomicString& name() const override; 139 int screenLeft() const { return screenX(); }
119 void setName(const AtomicString&) override; 140 int screenTop() const { return screenY(); }
120 String status() const override; 141 double scrollX() const;
121 void setStatus(const String&) override; 142 double scrollY() const;
122 String defaultStatus() const override; 143 double pageXOffset() const { return scrollX(); }
123 void setDefaultStatus(const String&) override; 144 double pageYOffset() const { return scrollY(); }
124 Document* document() const override; 145
125 StyleMedia* styleMedia() const override; 146 DOMVisualViewport* visualViewport();
126 double devicePixelRatio() const override; 147
127 ApplicationCache* applicationCache() const override; 148 const AtomicString& name() const;
128 int orientation() const override; 149 void setName(const AtomicString&);
129 DOMSelection* getSelection() override; 150
151 String status() const;
152 void setStatus(const String&);
153 String defaultStatus() const;
154 void setDefaultStatus(const String&);
155
156 // DOM Level 2 AbstractView Interface
157 Document* document() const;
158
159 // CSSOM View Module
160 StyleMedia* styleMedia() const;
161
162 // WebKit extensions
163 double devicePixelRatio() const;
164
165 ApplicationCache* applicationCache() const;
166
167 // This is the interface orientation in degrees. Some examples are:
168 // 0 is straight up; -90 is when the device is rotated 90 clockwise;
169 // 90 is when rotated counter clockwise.
170 int orientation() const;
171
172 DOMSelection* getSelection();
173
130 void blur() override; 174 void blur() override;
131 void print(ScriptState*) override; 175 void print(ScriptState*);
132 void stop() override; 176 void stop();
133 void alert(ScriptState*, const String& message = String()) override; 177
134 bool confirm(ScriptState*, const String& message) override; 178 void alert(ScriptState*, const String& message = String());
179 bool confirm(ScriptState*, const String& message);
135 String prompt(ScriptState*, 180 String prompt(ScriptState*,
136 const String& message, 181 const String& message,
137 const String& defaultValue) override; 182 const String& defaultValue);
183
138 bool find(const String&, 184 bool find(const String&,
139 bool caseSensitive, 185 bool caseSensitive,
140 bool backwards, 186 bool backwards,
141 bool wrap, 187 bool wrap,
142 bool wholeWord, 188 bool wholeWord,
143 bool searchInFrames, 189 bool searchInFrames,
144 bool showDialog) const override; 190 bool showDialog) const;
145 191
146 // FIXME: ScrollBehaviorSmooth is currently unsupported in VisualViewport. 192 // FIXME: ScrollBehaviorSmooth is currently unsupported in VisualViewport.
147 // crbug.com/434497 193 // crbug.com/434497
148 void scrollBy(double x, 194 void scrollBy(double x, double y, ScrollBehavior = ScrollBehaviorAuto) const;
149 double y, 195 void scrollBy(const ScrollToOptions&) const;
150 ScrollBehavior = ScrollBehaviorAuto) const override; 196 void scrollTo(double x, double y) const;
151 void scrollBy(const ScrollToOptions&) const override; 197 void scrollTo(const ScrollToOptions&) const;
152 void scrollTo(double x, double y) const override; 198 void scroll(double x, double y) const { scrollTo(x, y); }
153 void scrollTo(const ScrollToOptions&) const override; 199 void scroll(const ScrollToOptions& scrollToOptions) const {
200 scrollTo(scrollToOptions);
201 }
202 void moveBy(int x, int y) const;
203 void moveTo(int x, int y) const;
154 204
155 void moveBy(int x, int y) const override; 205 void resizeBy(int x, int y) const;
156 void moveTo(int x, int y) const override; 206 void resizeTo(int width, int height) const;
157 void resizeBy(int x, int y) const override; 207
158 void resizeTo(int width, int height) const override; 208 MediaQueryList* matchMedia(const String&);
159 MediaQueryList* matchMedia(const String&) override; 209
210 // DOM Level 2 Style Interface
160 CSSStyleDeclaration* getComputedStyle(Element*, 211 CSSStyleDeclaration* getComputedStyle(Element*,
161 const String& pseudoElt) const override; 212 const String& pseudoElt) const;
162 CSSRuleList* getMatchedCSSRules(Element*, 213
163 const String& pseudoElt) const override; 214 // WebKit extension
164 int requestAnimationFrame(FrameRequestCallback*) override; 215 CSSRuleList* getMatchedCSSRules(Element*, const String& pseudoElt) const;
165 int webkitRequestAnimationFrame(FrameRequestCallback*) override; 216
166 void cancelAnimationFrame(int id) override; 217 // WebKit animation extensions
167 int requestIdleCallback(IdleRequestCallback*, 218 int requestAnimationFrame(FrameRequestCallback*);
168 const IdleRequestOptions&) override; 219 int webkitRequestAnimationFrame(FrameRequestCallback*);
169 void cancelIdleCallback(int id) override; 220 void cancelAnimationFrame(int id);
170 CustomElementRegistry* customElements(ScriptState*) const override; 221
222 // Idle callback extensions
223 int requestIdleCallback(IdleRequestCallback*, const IdleRequestOptions&);
224 void cancelIdleCallback(int id);
225
226 // Custom elements
227 CustomElementRegistry* customElements(ScriptState*) const;
171 CustomElementRegistry* customElements() const; 228 CustomElementRegistry* customElements() const;
172 CustomElementRegistry* maybeCustomElements() const; 229 CustomElementRegistry* maybeCustomElements() const;
173 230
231 // Obsolete APIs
232 void captureEvents() {}
233 void releaseEvents() {}
234 External* external();
235
236 bool isSecureContext() const;
237
238 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend);
239 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration);
240 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart);
241 DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
242 DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend);
243 DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel);
244
245 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart,
246 webkitAnimationStart);
247 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration,
248 webkitAnimationIteration);
249 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend,
250 webkitAnimationEnd);
251 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend,
252 webkitTransitionEnd);
253
254 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange);
255
174 void registerEventListenerObserver(EventListenerObserver*); 256 void registerEventListenerObserver(EventListenerObserver*);
175 257
176 void frameDestroyed(); 258 void frameDestroyed();
177 void reset(); 259 void reset();
178 260
179 unsigned pendingUnloadEventListeners() const; 261 unsigned pendingUnloadEventListeners() const;
180 262
181 bool allowPopUp(); // Call on first window, not target window. 263 bool allowPopUp(); // Call on first window, not target window.
182 static bool allowPopUp(LocalFrame& firstFrame); 264 static bool allowPopUp(LocalFrame& firstFrame);
183 265
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 mutable Member<History> m_history; 349 mutable Member<History> m_history;
268 mutable Member<BarProp> m_locationbar; 350 mutable Member<BarProp> m_locationbar;
269 mutable Member<BarProp> m_menubar; 351 mutable Member<BarProp> m_menubar;
270 mutable Member<BarProp> m_personalbar; 352 mutable Member<BarProp> m_personalbar;
271 mutable Member<BarProp> m_scrollbars; 353 mutable Member<BarProp> m_scrollbars;
272 mutable Member<BarProp> m_statusbar; 354 mutable Member<BarProp> m_statusbar;
273 mutable Member<BarProp> m_toolbar; 355 mutable Member<BarProp> m_toolbar;
274 mutable Member<Navigator> m_navigator; 356 mutable Member<Navigator> m_navigator;
275 mutable Member<StyleMedia> m_media; 357 mutable Member<StyleMedia> m_media;
276 mutable TraceWrapperMember<CustomElementRegistry> m_customElements; 358 mutable TraceWrapperMember<CustomElementRegistry> m_customElements;
359 Member<External> m_external;
277 360
278 String m_status; 361 String m_status;
279 String m_defaultStatus; 362 String m_defaultStatus;
280 363
281 mutable Member<ApplicationCache> m_applicationCache; 364 mutable Member<ApplicationCache> m_applicationCache;
282 365
283 Member<DOMWindowEventQueue> m_eventQueue; 366 Member<DOMWindowEventQueue> m_eventQueue;
284 RefPtr<SerializedScriptValue> m_pendingStateObject; 367 RefPtr<SerializedScriptValue> m_pendingStateObject;
285 368
286 HeapHashSet<Member<PostMessageTimer>> m_postMessageTimers; 369 HeapHashSet<Member<PostMessageTimer>> m_postMessageTimers;
(...skipping 10 matching lines...) Expand all
297 return m_status; 380 return m_status;
298 } 381 }
299 382
300 inline String LocalDOMWindow::defaultStatus() const { 383 inline String LocalDOMWindow::defaultStatus() const {
301 return m_defaultStatus; 384 return m_defaultStatus;
302 } 385 }
303 386
304 } // namespace blink 387 } // namespace blink
305 388
306 #endif // LocalDOMWindow_h 389 #endif // LocalDOMWindow_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.cpp ('k') | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698