| 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/DOMWindow.h" | 26 #include "core/frame/DOMWindow.h" |
| 27 #include "core/frame/FrameOwner.h" | 27 #include "core/frame/FrameOwner.h" |
| 28 #include "core/html/HTMLElement.h" | 28 #include "core/html/HTMLElement.h" |
| 29 #include "platform/feature_policy/FeaturePolicy.h" |
| 29 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
| 30 #include "platform/scroll/ScrollTypes.h" | 31 #include "platform/scroll/ScrollTypes.h" |
| 31 #include "platform/weborigin/SecurityPolicy.h" | 32 #include "platform/weborigin/SecurityPolicy.h" |
| 32 #include "platform/wtf/HashCountedSet.h" | 33 #include "platform/wtf/HashCountedSet.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 class ExceptionState; | 37 class ExceptionState; |
| 37 class Frame; | 38 class Frame; |
| 38 class FrameOrPlugin; | 39 class FrameOrPlugin; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return getAttribute(HTMLNames::nameAttr); | 89 return getAttribute(HTMLNames::nameAttr); |
| 89 } | 90 } |
| 90 ScrollbarMode ScrollingMode() const override { return kScrollbarAuto; } | 91 ScrollbarMode ScrollingMode() const override { return kScrollbarAuto; } |
| 91 int MarginWidth() const override { return -1; } | 92 int MarginWidth() const override { return -1; } |
| 92 int MarginHeight() const override { return -1; } | 93 int MarginHeight() const override { return -1; } |
| 93 bool AllowFullscreen() const override { return false; } | 94 bool AllowFullscreen() const override { return false; } |
| 94 bool AllowPaymentRequest() const override { return false; } | 95 bool AllowPaymentRequest() const override { return false; } |
| 95 bool IsDisplayNone() const override { return !widget_; } | 96 bool IsDisplayNone() const override { return !widget_; } |
| 96 AtomicString Csp() const override { return g_null_atom; } | 97 AtomicString Csp() const override { return g_null_atom; } |
| 97 const WebVector<WebFeaturePolicyFeature>& AllowedFeatures() const override; | 98 const WebVector<WebFeaturePolicyFeature>& AllowedFeatures() const override; |
| 99 const WebParsedFeaturePolicy& ContainerPolicy() const override; |
| 100 |
| 101 // For unit tests, manually trigger the UpdateContainerPolicy method. |
| 102 void UpdateContainerPolicyForTests() { UpdateContainerPolicy(); } |
| 98 | 103 |
| 99 DECLARE_VIRTUAL_TRACE(); | 104 DECLARE_VIRTUAL_TRACE(); |
| 100 | 105 |
| 101 protected: | 106 protected: |
| 102 HTMLFrameOwnerElement(const QualifiedName& tag_name, Document&); | 107 HTMLFrameOwnerElement(const QualifiedName& tag_name, Document&); |
| 103 void SetSandboxFlags(SandboxFlags); | 108 void SetSandboxFlags(SandboxFlags); |
| 104 | 109 |
| 105 bool LoadOrRedirectSubframe(const KURL&, | 110 bool LoadOrRedirectSubframe(const KURL&, |
| 106 const AtomicString& frame_name, | 111 const AtomicString& frame_name, |
| 107 bool replace_current_item); | 112 bool replace_current_item); |
| 108 bool IsKeyboardFocusable() const override; | 113 bool IsKeyboardFocusable() const override; |
| 109 | 114 |
| 110 void DisposeFrameOrPluginSoon(FrameOrPlugin*); | 115 void DisposeFrameOrPluginSoon(FrameOrPlugin*); |
| 111 void FrameOwnerPropertiesChanged(); | 116 void FrameOwnerPropertiesChanged(); |
| 112 | 117 |
| 118 // Return the origin which is to be used for feature policy container |
| 119 // policies, as "the origin of the URL in the frame's src attribute" (see |
| 120 // https://wicg.github.io/feature-policy/#iframe-allow-attribute). |
| 121 // This method is intended to be overridden by specific frame classes. |
| 122 virtual RefPtr<SecurityOrigin> GetOriginForFeaturePolicy() const { |
| 123 return SecurityOrigin::CreateUnique(); |
| 124 } |
| 125 |
| 126 // Construct a new feature policy container policy for this frame, based on |
| 127 // the frame attributes and the effective origin specified in the frame |
| 128 // attributes. |
| 129 void UpdateContainerPolicy(); |
| 130 |
| 113 private: | 131 private: |
| 114 // Intentionally private to prevent redundant checks when the type is | 132 // Intentionally private to prevent redundant checks when the type is |
| 115 // already HTMLFrameOwnerElement. | 133 // already HTMLFrameOwnerElement. |
| 116 bool IsLocal() const final { return true; } | 134 bool IsLocal() const final { return true; } |
| 117 bool IsRemote() const final { return false; } | 135 bool IsRemote() const final { return false; } |
| 118 | 136 |
| 119 bool IsFrameOwnerElement() const final { return true; } | 137 bool IsFrameOwnerElement() const final { return true; } |
| 120 | 138 |
| 121 virtual ReferrerPolicy ReferrerPolicyAttribute() { | 139 virtual ReferrerPolicy ReferrerPolicyAttribute() { |
| 122 return kReferrerPolicyDefault; | 140 return kReferrerPolicyDefault; |
| 123 } | 141 } |
| 124 | 142 |
| 125 Member<Frame> content_frame_; | 143 Member<Frame> content_frame_; |
| 126 Member<FrameViewBase> widget_; | 144 Member<FrameViewBase> widget_; |
| 127 SandboxFlags sandbox_flags_; | 145 SandboxFlags sandbox_flags_; |
| 146 |
| 147 WebParsedFeaturePolicy container_policy_; |
| 128 }; | 148 }; |
| 129 | 149 |
| 130 DEFINE_ELEMENT_TYPE_CASTS(HTMLFrameOwnerElement, IsFrameOwnerElement()); | 150 DEFINE_ELEMENT_TYPE_CASTS(HTMLFrameOwnerElement, IsFrameOwnerElement()); |
| 131 | 151 |
| 132 class SubframeLoadingDisabler { | 152 class SubframeLoadingDisabler { |
| 133 STACK_ALLOCATED(); | 153 STACK_ALLOCATED(); |
| 134 | 154 |
| 135 public: | 155 public: |
| 136 explicit SubframeLoadingDisabler(Node& root) | 156 explicit SubframeLoadingDisabler(Node& root) |
| 137 : SubframeLoadingDisabler(&root) {} | 157 : SubframeLoadingDisabler(&root) {} |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 189 |
| 170 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement, | 190 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement, |
| 171 FrameOwner, | 191 FrameOwner, |
| 172 owner, | 192 owner, |
| 173 owner->IsLocal(), | 193 owner->IsLocal(), |
| 174 owner.IsLocal()); | 194 owner.IsLocal()); |
| 175 | 195 |
| 176 } // namespace blink | 196 } // namespace blink |
| 177 | 197 |
| 178 #endif // HTMLFrameOwnerElement_h | 198 #endif // HTMLFrameOwnerElement_h |
| OLD | NEW |