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

Side by Side Diff: third_party/WebKit/Source/core/frame/RemoteDOMWindow.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 // 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 RemoteDOMWindow_h 5 #ifndef RemoteDOMWindow_h
6 #define RemoteDOMWindow_h 6 #define RemoteDOMWindow_h
7 7
8 #include "core/frame/DOMWindow.h" 8 #include "core/frame/DOMWindow.h"
9 #include "core/frame/RemoteFrame.h" 9 #include "core/frame/RemoteFrame.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class RemoteDOMWindow final : public DOMWindow { 14 class RemoteDOMWindow final : public DOMWindow {
15 public: 15 public:
16 static RemoteDOMWindow* create(RemoteFrame& frame) { 16 static RemoteDOMWindow* create(RemoteFrame& frame) {
17 return new RemoteDOMWindow(frame); 17 return new RemoteDOMWindow(frame);
18 } 18 }
19 19
20 RemoteFrame* frame() const { return toRemoteFrame(DOMWindow::frame()); } 20 RemoteFrame* frame() const { return toRemoteFrame(DOMWindow::frame()); }
21 21
22 // EventTarget overrides: 22 // EventTarget overrides:
23 ExecutionContext* getExecutionContext() const override; 23 ExecutionContext* getExecutionContext() const override;
24 24
25 // DOMWindow overrides: 25 // DOMWindow overrides:
26 DECLARE_VIRTUAL_TRACE(); 26 DECLARE_VIRTUAL_TRACE();
27 Screen* screen() const override;
28 History* history() const override;
29 BarProp* locationbar() const override;
30 BarProp* menubar() const override;
31 BarProp* personalbar() const override;
32 BarProp* scrollbars() const override;
33 BarProp* statusbar() const override;
34 BarProp* toolbar() const override;
35 Navigator* navigator() const override;
36 bool offscreenBuffering() const override;
37 int outerHeight() const override;
38 int outerWidth() const override;
39 int innerHeight() const override;
40 int innerWidth() const override;
41 int screenX() const override;
42 int screenY() const override;
43 double scrollX() const override;
44 double scrollY() const override;
45 const AtomicString& name() const override;
46 void setName(const AtomicString&) override;
47 String status() const override;
48 void setStatus(const String&) override;
49 String defaultStatus() const override;
50 void setDefaultStatus(const String&) override;
51 Document* document() const override;
52 StyleMedia* styleMedia() const override;
53 double devicePixelRatio() const override;
54 ApplicationCache* applicationCache() const override;
55 int orientation() const override;
56 DOMSelection* getSelection() override;
57 void blur() override; 27 void blur() override;
58 void print(ScriptState*) override;
59 void stop() override;
60 void alert(ScriptState*, const String& message = String()) override;
61 bool confirm(ScriptState*, const String& message) override;
62 String prompt(ScriptState*,
63 const String& message,
64 const String& defaultValue) override;
65 bool find(const String&,
66 bool caseSensitive,
67 bool backwards,
68 bool wrap,
69 bool wholeWord,
70 bool searchInFrames,
71 bool showDialog) const override;
72 void scrollBy(double x,
73 double y,
74 ScrollBehavior = ScrollBehaviorAuto) const override;
75 void scrollBy(const ScrollToOptions&) const override;
76 void scrollTo(double x, double y) const override;
77 void scrollTo(const ScrollToOptions&) const override;
78 void moveBy(int x, int y) const override;
79 void moveTo(int x, int y) const override;
80 void resizeBy(int x, int y) const override;
81 void resizeTo(int width, int height) const override;
82 MediaQueryList* matchMedia(const String&) override;
83 CSSStyleDeclaration* getComputedStyle(Element*,
84 const String& pseudoElt) const override;
85 CSSRuleList* getMatchedCSSRules(Element*,
86 const String& pseudoElt) const override;
87 int requestAnimationFrame(FrameRequestCallback*) override;
88 int webkitRequestAnimationFrame(FrameRequestCallback*) override;
89 void cancelAnimationFrame(int id) override;
90 int requestIdleCallback(IdleRequestCallback*,
91 const IdleRequestOptions&) override;
92 void cancelIdleCallback(int id) override;
93 CustomElementRegistry* customElements(ScriptState*) const override;
94 28
95 void frameDetached(); 29 void frameDetached();
96 30
97 protected: 31 protected:
98 // Protected DOMWindow overrides: 32 // Protected DOMWindow overrides:
99 void schedulePostMessage(MessageEvent*, 33 void schedulePostMessage(MessageEvent*,
100 PassRefPtr<SecurityOrigin> target, 34 PassRefPtr<SecurityOrigin> target,
101 Document* source) override; 35 Document* source) override;
102 36
103 private: 37 private:
104 explicit RemoteDOMWindow(RemoteFrame&); 38 explicit RemoteDOMWindow(RemoteFrame&);
105 39
106 // Intentionally private to prevent redundant checks when the type is 40 // Intentionally private to prevent redundant checks when the type is
107 // already RemoteDOMWindow. 41 // already RemoteDOMWindow.
108 bool isLocalDOMWindow() const override { return false; } 42 bool isLocalDOMWindow() const override { return false; }
109 bool isRemoteDOMWindow() const override { return true; } 43 bool isRemoteDOMWindow() const override { return true; }
110 }; 44 };
111 45
112 DEFINE_TYPE_CASTS(RemoteDOMWindow, 46 DEFINE_TYPE_CASTS(RemoteDOMWindow,
113 DOMWindow, 47 DOMWindow,
114 x, 48 x,
115 x->isRemoteDOMWindow(), 49 x->isRemoteDOMWindow(),
116 x.isRemoteDOMWindow()); 50 x.isRemoteDOMWindow());
117 51
118 } // namespace blink 52 } // namespace blink
119 53
120 #endif // DOMWindow_h 54 #endif // DOMWindow_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | third_party/WebKit/Source/core/frame/RemoteDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698