OLD | NEW |
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 | 19 class RemoteFrameOwner final |
20 : public GarbageCollectedFinalized<RemoteFrameOwner>, | 20 : public GarbageCollectedFinalized<RemoteFrameOwner>, |
21 public FrameOwner { | 21 public FrameOwner { |
22 USING_GARBAGE_COLLECTED_MIXIN(RemoteFrameOwner); | 22 USING_GARBAGE_COLLECTED_MIXIN(RemoteFrameOwner); |
23 | 23 |
24 public: | 24 public: |
25 static RemoteFrameOwner* create( | 25 static RemoteFrameOwner* create( |
26 SandboxFlags flags, | 26 SandboxFlags flags, |
| 27 const WebParsedFeaturePolicy& containerPolicy, |
27 const WebFrameOwnerProperties& frameOwnerProperties) { | 28 const WebFrameOwnerProperties& frameOwnerProperties) { |
28 return new RemoteFrameOwner(flags, frameOwnerProperties); | 29 return new RemoteFrameOwner(flags, containerPolicy, frameOwnerProperties); |
29 } | 30 } |
30 | 31 |
31 // FrameOwner overrides: | 32 // FrameOwner overrides: |
32 Frame* contentFrame() const override { return m_frame.get(); } | 33 Frame* contentFrame() const override { return m_frame.get(); } |
33 void setContentFrame(Frame&) override; | 34 void setContentFrame(Frame&) override; |
34 void clearContentFrame() override; | 35 void clearContentFrame() override; |
35 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } | 36 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } |
36 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } | 37 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } |
37 void dispatchLoad() override; | 38 void dispatchLoad() override; |
38 // TODO(dcheng): Implement. | 39 // TODO(dcheng): Implement. |
39 bool canRenderFallbackContent() const override { return false; } | 40 bool canRenderFallbackContent() const override { return false; } |
40 void renderFallbackContent() override {} | 41 void renderFallbackContent() override {} |
41 | 42 |
42 AtomicString browsingContextContainerName() const override { | 43 AtomicString browsingContextContainerName() const override { |
43 return m_browsingContextContainerName; | 44 return m_browsingContextContainerName; |
44 } | 45 } |
45 ScrollbarMode scrollingMode() const override { return m_scrolling; } | 46 ScrollbarMode scrollingMode() const override { return m_scrolling; } |
46 int marginWidth() const override { return m_marginWidth; } | 47 int marginWidth() const override { return m_marginWidth; } |
47 int marginHeight() const override { return m_marginHeight; } | 48 int marginHeight() const override { return m_marginHeight; } |
48 bool allowFullscreen() const override { return m_allowFullscreen; } | 49 bool allowFullscreen() const override { return m_allowFullscreen; } |
49 bool allowPaymentRequest() const override { return m_allowPaymentRequest; } | 50 bool allowPaymentRequest() const override { return m_allowPaymentRequest; } |
50 bool isDisplayNone() const override { return m_isDisplayNone; } | 51 bool isDisplayNone() const override { return m_isDisplayNone; } |
51 AtomicString csp() const override { return m_csp; } | 52 AtomicString csp() const override { return m_csp; } |
52 const WebVector<WebFeaturePolicyFeature>& allowedFeatures() const override { | 53 const WebVector<WebFeaturePolicyFeature>& allowedFeatures() const override { |
53 return m_allowedFeatures; | 54 return m_allowedFeatures; |
54 } | 55 } |
| 56 const WebParsedFeaturePolicy& containerPolicy() const override { |
| 57 return m_containerPolicy; |
| 58 } |
55 | 59 |
56 void setBrowsingContextContainerName(const WebString& name) { | 60 void setBrowsingContextContainerName(const WebString& name) { |
57 m_browsingContextContainerName = name; | 61 m_browsingContextContainerName = name; |
58 } | 62 } |
59 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); | 63 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); |
60 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } | 64 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } |
61 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } | 65 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } |
62 void setAllowFullscreen(bool allowFullscreen) { | 66 void setAllowFullscreen(bool allowFullscreen) { |
63 m_allowFullscreen = allowFullscreen; | 67 m_allowFullscreen = allowFullscreen; |
64 } | 68 } |
65 void setAllowPaymentRequest(bool allowPaymentRequest) { | 69 void setAllowPaymentRequest(bool allowPaymentRequest) { |
66 m_allowPaymentRequest = allowPaymentRequest; | 70 m_allowPaymentRequest = allowPaymentRequest; |
67 } | 71 } |
68 void setIsDisplayNone(bool isDisplayNone) { m_isDisplayNone = isDisplayNone; } | 72 void setIsDisplayNone(bool isDisplayNone) { m_isDisplayNone = isDisplayNone; } |
69 void setCsp(const WebString& csp) { m_csp = csp; } | 73 void setCsp(const WebString& csp) { m_csp = csp; } |
70 void setAllowedFeatures( | 74 void setAllowedFeatures( |
71 const WebVector<WebFeaturePolicyFeature>& allowedFeatures) { | 75 const WebVector<WebFeaturePolicyFeature>& allowedFeatures) { |
72 m_allowedFeatures = allowedFeatures; | 76 m_allowedFeatures = allowedFeatures; |
73 } | 77 } |
| 78 void setContainerPolicy(const WebParsedFeaturePolicy& containerPolicy) { |
| 79 m_containerPolicy = containerPolicy; |
| 80 } |
74 | 81 |
75 DECLARE_VIRTUAL_TRACE(); | 82 DECLARE_VIRTUAL_TRACE(); |
76 | 83 |
77 private: | 84 private: |
78 RemoteFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); | 85 RemoteFrameOwner(SandboxFlags, |
| 86 const WebParsedFeaturePolicy&, |
| 87 const WebFrameOwnerProperties&); |
79 | 88 |
80 // Intentionally private to prevent redundant checks when the type is | 89 // Intentionally private to prevent redundant checks when the type is |
81 // already HTMLFrameOwnerElement. | 90 // already HTMLFrameOwnerElement. |
82 bool isLocal() const override { return false; } | 91 bool isLocal() const override { return false; } |
83 bool isRemote() const override { return true; } | 92 bool isRemote() const override { return true; } |
84 | 93 |
85 Member<Frame> m_frame; | 94 Member<Frame> m_frame; |
86 SandboxFlags m_sandboxFlags; | 95 SandboxFlags m_sandboxFlags; |
87 AtomicString m_browsingContextContainerName; | 96 AtomicString m_browsingContextContainerName; |
88 ScrollbarMode m_scrolling; | 97 ScrollbarMode m_scrolling; |
89 int m_marginWidth; | 98 int m_marginWidth; |
90 int m_marginHeight; | 99 int m_marginHeight; |
91 bool m_allowFullscreen; | 100 bool m_allowFullscreen; |
92 bool m_allowPaymentRequest; | 101 bool m_allowPaymentRequest; |
93 bool m_isDisplayNone; | 102 bool m_isDisplayNone; |
94 WebString m_csp; | 103 WebString m_csp; |
95 WebVector<WebFeaturePolicyFeature> m_allowedFeatures; | 104 WebVector<WebFeaturePolicyFeature> m_allowedFeatures; |
| 105 WebParsedFeaturePolicy m_containerPolicy; |
96 }; | 106 }; |
97 | 107 |
98 DEFINE_TYPE_CASTS(RemoteFrameOwner, | 108 DEFINE_TYPE_CASTS(RemoteFrameOwner, |
99 FrameOwner, | 109 FrameOwner, |
100 owner, | 110 owner, |
101 owner->isRemote(), | 111 owner->isRemote(), |
102 owner.isRemote()); | 112 owner.isRemote()); |
103 | 113 |
104 } // namespace blink | 114 } // namespace blink |
105 | 115 |
106 #endif // RemoteFrameOwner_h | 116 #endif // RemoteFrameOwner_h |
OLD | NEW |