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

Side by Side Diff: third_party/WebKit/Source/web/RemoteFrameOwner.h

Issue 2015003002: Disallow local/remote checks on subclasses of Frame, FrameOwner and DOMWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pure virtual Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be found 2 // Use of this source code is governed by a BSD-style license that can be found
3 // in the LICENSE file. 3 // in the LICENSE file.
4 4
5 #ifndef RemoteFrameOwner_h 5 #ifndef RemoteFrameOwner_h
6 #define RemoteFrameOwner_h 6 #define RemoteFrameOwner_h
7 7
8 #include "core/frame/FrameOwner.h" 8 #include "core/frame/FrameOwner.h"
9 #include "platform/scroll/ScrollTypes.h" 9 #include "platform/scroll/ScrollTypes.h"
10 #include "public/web/WebFrameOwnerProperties.h" 10 #include "public/web/WebFrameOwnerProperties.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 // Helper class to bridge communication for a frame with a remote parent. 14 // Helper class to bridge communication for a frame with a remote parent.
15 // Currently, it serves two purposes: 15 // Currently, it serves two purposes:
16 // 1. Allows the local frame's loader to retrieve sandbox flags associated with 16 // 1. Allows the local frame's loader to retrieve sandbox flags associated with
17 // its owner element in another process. 17 // its owner element in another process.
18 // 2. Trigger a load event on its owner element once it finishes a load. 18 // 2. Trigger a load event on its owner element once it finishes a load.
19 class RemoteFrameOwner final : public GarbageCollectedFinalized<RemoteFrameOwner >, public FrameOwner { 19 class RemoteFrameOwner final : public GarbageCollectedFinalized<RemoteFrameOwner >, public FrameOwner {
20 USING_GARBAGE_COLLECTED_MIXIN(RemoteFrameOwner); 20 USING_GARBAGE_COLLECTED_MIXIN(RemoteFrameOwner);
21 public: 21 public:
22 static RemoteFrameOwner* create(SandboxFlags flags, const WebFrameOwnerPrope rties& frameOwnerProperties) 22 static RemoteFrameOwner* create(SandboxFlags flags, const WebFrameOwnerPrope rties& frameOwnerProperties)
23 { 23 {
24 return new RemoteFrameOwner(flags, frameOwnerProperties); 24 return new RemoteFrameOwner(flags, frameOwnerProperties);
25 } 25 }
26 26
27 // FrameOwner overrides: 27 // FrameOwner overrides:
28 bool isLocal() const override { return false; }
29 bool isRemote() const override { return true; }
30 void setContentFrame(Frame&) override; 28 void setContentFrame(Frame&) override;
31 void clearContentFrame() override; 29 void clearContentFrame() override;
32 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } 30 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; }
33 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } 31 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; }
34 void dispatchLoad() override; 32 void dispatchLoad() override;
35 // TODO(dcheng): Implement. 33 // TODO(dcheng): Implement.
36 void renderFallbackContent() override { } 34 void renderFallbackContent() override { }
37 ScrollbarMode scrollingMode() const override { return m_scrolling; } 35 ScrollbarMode scrollingMode() const override { return m_scrolling; }
38 int marginWidth() const override { return m_marginWidth; } 36 int marginWidth() const override { return m_marginWidth; }
39 int marginHeight() const override { return m_marginHeight; } 37 int marginHeight() const override { return m_marginHeight; }
40 bool allowFullscreen() const override { return m_allowFullscreen; } 38 bool allowFullscreen() const override { return m_allowFullscreen; }
41 39
42 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); 40 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode);
43 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } 41 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; }
44 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } 42 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; }
45 void setAllowFullscreen(bool allowFullscreen) { m_allowFullscreen = allowFul lscreen; } 43 void setAllowFullscreen(bool allowFullscreen) { m_allowFullscreen = allowFul lscreen; }
46 44
47 DECLARE_VIRTUAL_TRACE(); 45 DECLARE_VIRTUAL_TRACE();
48 46
49 private: 47 private:
50 RemoteFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); 48 RemoteFrameOwner(SandboxFlags, const WebFrameOwnerProperties&);
51 49
50 // Intentionally private to prevent redundant checks when the type is
51 // already HTMLFrameOwnerElement.
52 bool isLocal() const override { return false; }
53 bool isRemote() const override { return true; }
54
52 Member<Frame> m_frame; 55 Member<Frame> m_frame;
53 SandboxFlags m_sandboxFlags; 56 SandboxFlags m_sandboxFlags;
54 ScrollbarMode m_scrolling; 57 ScrollbarMode m_scrolling;
55 int m_marginWidth; 58 int m_marginWidth;
56 int m_marginHeight; 59 int m_marginHeight;
57 bool m_allowFullscreen; 60 bool m_allowFullscreen;
58 }; 61 };
59 62
60 DEFINE_TYPE_CASTS(RemoteFrameOwner, FrameOwner, owner, owner->isRemote(), owner. isRemote()); 63 DEFINE_TYPE_CASTS(RemoteFrameOwner, FrameOwner, owner, owner->isRemote(), owner. isRemote());
61 64
62 } // namespace blink 65 } // namespace blink
63 66
64 #endif // RemoteFrameOwner_h 67 #endif // RemoteFrameOwner_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698