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& container_policy, |
27 const WebFrameOwnerProperties& frame_owner_properties) { | 28 const WebFrameOwnerProperties& frame_owner_properties) { |
28 return new RemoteFrameOwner(flags, frame_owner_properties); | 29 return new RemoteFrameOwner(flags, container_policy, |
| 30 frame_owner_properties); |
29 } | 31 } |
30 | 32 |
31 // FrameOwner overrides: | 33 // FrameOwner overrides: |
32 Frame* ContentFrame() const override { return frame_.Get(); } | 34 Frame* ContentFrame() const override { return frame_.Get(); } |
33 void SetContentFrame(Frame&) override; | 35 void SetContentFrame(Frame&) override; |
34 void ClearContentFrame() override; | 36 void ClearContentFrame() override; |
35 SandboxFlags GetSandboxFlags() const override { return sandbox_flags_; } | 37 SandboxFlags GetSandboxFlags() const override { return sandbox_flags_; } |
36 void SetSandboxFlags(SandboxFlags flags) { sandbox_flags_ = flags; } | 38 void SetSandboxFlags(SandboxFlags flags) { sandbox_flags_ = flags; } |
37 void DispatchLoad() override; | 39 void DispatchLoad() override; |
38 // TODO(dcheng): Implement. | 40 // TODO(dcheng): Implement. |
39 bool CanRenderFallbackContent() const override { return false; } | 41 bool CanRenderFallbackContent() const override { return false; } |
40 void RenderFallbackContent() override {} | 42 void RenderFallbackContent() override {} |
41 | 43 |
42 AtomicString BrowsingContextContainerName() const override { | 44 AtomicString BrowsingContextContainerName() const override { |
43 return browsing_context_container_name_; | 45 return browsing_context_container_name_; |
44 } | 46 } |
45 ScrollbarMode ScrollingMode() const override { return scrolling_; } | 47 ScrollbarMode ScrollingMode() const override { return scrolling_; } |
46 int MarginWidth() const override { return margin_width_; } | 48 int MarginWidth() const override { return margin_width_; } |
47 int MarginHeight() const override { return margin_height_; } | 49 int MarginHeight() const override { return margin_height_; } |
48 bool AllowFullscreen() const override { return allow_fullscreen_; } | 50 bool AllowFullscreen() const override { return allow_fullscreen_; } |
49 bool AllowPaymentRequest() const override { return allow_payment_request_; } | 51 bool AllowPaymentRequest() const override { return allow_payment_request_; } |
50 bool IsDisplayNone() const override { return is_display_none_; } | 52 bool IsDisplayNone() const override { return is_display_none_; } |
51 AtomicString Csp() const override { return csp_; } | 53 AtomicString Csp() const override { return csp_; } |
52 const WebVector<WebFeaturePolicyFeature>& AllowedFeatures() const override { | 54 const WebVector<WebFeaturePolicyFeature>& AllowedFeatures() const override { |
53 return allowed_features_; | 55 return allowed_features_; |
54 } | 56 } |
| 57 const WebParsedFeaturePolicy& ContainerPolicy() const override { |
| 58 return container_policy_; |
| 59 } |
55 | 60 |
56 void SetBrowsingContextContainerName(const WebString& name) { | 61 void SetBrowsingContextContainerName(const WebString& name) { |
57 browsing_context_container_name_ = name; | 62 browsing_context_container_name_ = name; |
58 } | 63 } |
59 void SetScrollingMode(WebFrameOwnerProperties::ScrollingMode); | 64 void SetScrollingMode(WebFrameOwnerProperties::ScrollingMode); |
60 void SetMarginWidth(int margin_width) { margin_width_ = margin_width; } | 65 void SetMarginWidth(int margin_width) { margin_width_ = margin_width; } |
61 void SetMarginHeight(int margin_height) { margin_height_ = margin_height; } | 66 void SetMarginHeight(int margin_height) { margin_height_ = margin_height; } |
62 void SetAllowFullscreen(bool allow_fullscreen) { | 67 void SetAllowFullscreen(bool allow_fullscreen) { |
63 allow_fullscreen_ = allow_fullscreen; | 68 allow_fullscreen_ = allow_fullscreen; |
64 } | 69 } |
65 void SetAllowPaymentRequest(bool allow_payment_request) { | 70 void SetAllowPaymentRequest(bool allow_payment_request) { |
66 allow_payment_request_ = allow_payment_request; | 71 allow_payment_request_ = allow_payment_request; |
67 } | 72 } |
68 void SetIsDisplayNone(bool is_display_none) { | 73 void SetIsDisplayNone(bool is_display_none) { |
69 is_display_none_ = is_display_none; | 74 is_display_none_ = is_display_none; |
70 } | 75 } |
71 void SetCsp(const WebString& csp) { csp_ = csp; } | 76 void SetCsp(const WebString& csp) { csp_ = csp; } |
72 void SetAllowedFeatures( | 77 void SetAllowedFeatures( |
73 const WebVector<WebFeaturePolicyFeature>& allowed_features) { | 78 const WebVector<WebFeaturePolicyFeature>& allowed_features) { |
74 allowed_features_ = allowed_features; | 79 allowed_features_ = allowed_features; |
75 } | 80 } |
| 81 void SetContainerPolicy(const WebParsedFeaturePolicy& container_policy) { |
| 82 container_policy_ = container_policy; |
| 83 } |
76 | 84 |
77 DECLARE_VIRTUAL_TRACE(); | 85 DECLARE_VIRTUAL_TRACE(); |
78 | 86 |
79 private: | 87 private: |
80 RemoteFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); | 88 RemoteFrameOwner(SandboxFlags, |
| 89 const WebParsedFeaturePolicy&, |
| 90 const WebFrameOwnerProperties&); |
81 | 91 |
82 // Intentionally private to prevent redundant checks when the type is | 92 // Intentionally private to prevent redundant checks when the type is |
83 // already HTMLFrameOwnerElement. | 93 // already HTMLFrameOwnerElement. |
84 bool IsLocal() const override { return false; } | 94 bool IsLocal() const override { return false; } |
85 bool IsRemote() const override { return true; } | 95 bool IsRemote() const override { return true; } |
86 | 96 |
87 Member<Frame> frame_; | 97 Member<Frame> frame_; |
88 SandboxFlags sandbox_flags_; | 98 SandboxFlags sandbox_flags_; |
89 AtomicString browsing_context_container_name_; | 99 AtomicString browsing_context_container_name_; |
90 ScrollbarMode scrolling_; | 100 ScrollbarMode scrolling_; |
91 int margin_width_; | 101 int margin_width_; |
92 int margin_height_; | 102 int margin_height_; |
93 bool allow_fullscreen_; | 103 bool allow_fullscreen_; |
94 bool allow_payment_request_; | 104 bool allow_payment_request_; |
95 bool is_display_none_; | 105 bool is_display_none_; |
96 WebString csp_; | 106 WebString csp_; |
97 WebVector<WebFeaturePolicyFeature> allowed_features_; | 107 WebVector<WebFeaturePolicyFeature> allowed_features_; |
| 108 WebParsedFeaturePolicy container_policy_; |
98 }; | 109 }; |
99 | 110 |
100 DEFINE_TYPE_CASTS(RemoteFrameOwner, | 111 DEFINE_TYPE_CASTS(RemoteFrameOwner, |
101 FrameOwner, | 112 FrameOwner, |
102 owner, | 113 owner, |
103 owner->IsRemote(), | 114 owner->IsRemote(), |
104 owner.IsRemote()); | 115 owner.IsRemote()); |
105 | 116 |
106 } // namespace blink | 117 } // namespace blink |
107 | 118 |
108 #endif // RemoteFrameOwner_h | 119 #endif // RemoteFrameOwner_h |
OLD | NEW |