OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 * | 18 * |
19 */ | 19 */ |
20 | 20 |
21 #ifndef HTMLFrameOwnerElement_h | 21 #ifndef HTMLFrameOwnerElement_h |
22 #define HTMLFrameOwnerElement_h | 22 #define HTMLFrameOwnerElement_h |
23 | 23 |
24 #include "core/CoreExport.h" | 24 #include "core/CoreExport.h" |
25 #include "core/dom/Document.h" | 25 #include "core/dom/Document.h" |
26 #include "core/frame/FrameOwner.h" | 26 #include "core/frame/FrameOwner.h" |
27 #include "core/html/HTMLElement.h" | 27 #include "core/html/HTMLElement.h" |
| 28 #include "platform/feature_policy/FeaturePolicy.h" |
28 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
29 #include "platform/scroll/ScrollTypes.h" | 30 #include "platform/scroll/ScrollTypes.h" |
30 #include "platform/weborigin/SecurityPolicy.h" | 31 #include "platform/weborigin/SecurityPolicy.h" |
31 #include "platform/wtf/HashCountedSet.h" | 32 #include "platform/wtf/HashCountedSet.h" |
32 | 33 |
33 namespace blink { | 34 namespace blink { |
34 | 35 |
35 class ExceptionState; | 36 class ExceptionState; |
36 class Frame; | 37 class Frame; |
37 class FrameViewBase; | 38 class FrameViewBase; |
(...skipping 48 matching lines...) Loading... |
86 return getAttribute(HTMLNames::nameAttr); | 87 return getAttribute(HTMLNames::nameAttr); |
87 } | 88 } |
88 ScrollbarMode ScrollingMode() const override { return kScrollbarAuto; } | 89 ScrollbarMode ScrollingMode() const override { return kScrollbarAuto; } |
89 int MarginWidth() const override { return -1; } | 90 int MarginWidth() const override { return -1; } |
90 int MarginHeight() const override { return -1; } | 91 int MarginHeight() const override { return -1; } |
91 bool AllowFullscreen() const override { return false; } | 92 bool AllowFullscreen() const override { return false; } |
92 bool AllowPaymentRequest() const override { return false; } | 93 bool AllowPaymentRequest() const override { return false; } |
93 bool IsDisplayNone() const override { return !widget_; } | 94 bool IsDisplayNone() const override { return !widget_; } |
94 AtomicString Csp() const override { return g_null_atom; } | 95 AtomicString Csp() const override { return g_null_atom; } |
95 const WebVector<WebFeaturePolicyFeature>& AllowedFeatures() const override; | 96 const WebVector<WebFeaturePolicyFeature>& AllowedFeatures() const override; |
| 97 const WebParsedFeaturePolicy& ContainerPolicy() const override; |
| 98 |
| 99 // For unit tests, manually trigger the UpdateContainerPolicy method. |
| 100 void UpdateContainerPolicyForTests() { UpdateContainerPolicy(); } |
96 | 101 |
97 DECLARE_VIRTUAL_TRACE(); | 102 DECLARE_VIRTUAL_TRACE(); |
98 | 103 |
99 protected: | 104 protected: |
100 HTMLFrameOwnerElement(const QualifiedName& tag_name, Document&); | 105 HTMLFrameOwnerElement(const QualifiedName& tag_name, Document&); |
101 void SetSandboxFlags(SandboxFlags); | 106 void SetSandboxFlags(SandboxFlags); |
102 | 107 |
103 bool LoadOrRedirectSubframe(const KURL&, | 108 bool LoadOrRedirectSubframe(const KURL&, |
104 const AtomicString& frame_name, | 109 const AtomicString& frame_name, |
105 bool replace_current_item); | 110 bool replace_current_item); |
106 bool IsKeyboardFocusable() const override; | 111 bool IsKeyboardFocusable() const override; |
107 | 112 |
108 void DisposeWidgetSoon(FrameViewBase*); | 113 void DisposeWidgetSoon(FrameViewBase*); |
109 void FrameOwnerPropertiesChanged(); | 114 void FrameOwnerPropertiesChanged(); |
110 | 115 |
| 116 // Return the origin which is to be used for feature policy container |
| 117 // policies, when a specific origin is needed. This supports the "allow" |
| 118 // attribute, which uses the url specified by the parent document to determine |
| 119 // the origin when the frame is constructed. |
| 120 virtual const RefPtr<SecurityOrigin> GetOriginForFeaturePolicy() const { |
| 121 return SecurityOrigin::CreateUnique(); |
| 122 } |
| 123 |
| 124 // Construct a new feature policy container policy for this frame, based on |
| 125 // the frame attributes and the effective origin specified in the frame |
| 126 // attributes. |
| 127 void UpdateContainerPolicy(); |
| 128 |
111 private: | 129 private: |
112 // Intentionally private to prevent redundant checks when the type is | 130 // Intentionally private to prevent redundant checks when the type is |
113 // already HTMLFrameOwnerElement. | 131 // already HTMLFrameOwnerElement. |
114 bool IsLocal() const final { return true; } | 132 bool IsLocal() const final { return true; } |
115 bool IsRemote() const final { return false; } | 133 bool IsRemote() const final { return false; } |
116 | 134 |
117 bool IsFrameOwnerElement() const final { return true; } | 135 bool IsFrameOwnerElement() const final { return true; } |
118 | 136 |
119 virtual ReferrerPolicy ReferrerPolicyAttribute() { | 137 virtual ReferrerPolicy ReferrerPolicyAttribute() { |
120 return kReferrerPolicyDefault; | 138 return kReferrerPolicyDefault; |
121 } | 139 } |
122 | 140 |
123 Member<Frame> content_frame_; | 141 Member<Frame> content_frame_; |
124 Member<FrameViewBase> widget_; | 142 Member<FrameViewBase> widget_; |
125 SandboxFlags sandbox_flags_; | 143 SandboxFlags sandbox_flags_; |
| 144 |
| 145 WebParsedFeaturePolicy container_policy_; |
126 }; | 146 }; |
127 | 147 |
128 DEFINE_ELEMENT_TYPE_CASTS(HTMLFrameOwnerElement, IsFrameOwnerElement()); | 148 DEFINE_ELEMENT_TYPE_CASTS(HTMLFrameOwnerElement, IsFrameOwnerElement()); |
129 | 149 |
130 class SubframeLoadingDisabler { | 150 class SubframeLoadingDisabler { |
131 STACK_ALLOCATED(); | 151 STACK_ALLOCATED(); |
132 | 152 |
133 public: | 153 public: |
134 explicit SubframeLoadingDisabler(Node& root) | 154 explicit SubframeLoadingDisabler(Node& root) |
135 : SubframeLoadingDisabler(&root) {} | 155 : SubframeLoadingDisabler(&root) {} |
(...skipping 31 matching lines...) Loading... |
167 | 187 |
168 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement, | 188 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement, |
169 FrameOwner, | 189 FrameOwner, |
170 owner, | 190 owner, |
171 owner->IsLocal(), | 191 owner->IsLocal(), |
172 owner.IsLocal()); | 192 owner.IsLocal()); |
173 | 193 |
174 } // namespace blink | 194 } // namespace blink |
175 | 195 |
176 #endif // HTMLFrameOwnerElement_h | 196 #endif // HTMLFrameOwnerElement_h |
OLD | NEW |