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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp

Issue 2767983003: Initial Implementation of Iframe Attribute for Feature Policy (Part 4) (Closed)
Patch Set: Codereview: nit + added more unit tests for container policy Created 3 years, 7 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 /* 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
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 DOMWindow* HTMLFrameOwnerElement::contentWindow() const { 203 DOMWindow* HTMLFrameOwnerElement::contentWindow() const {
204 return content_frame_ ? content_frame_->DomWindow() : 0; 204 return content_frame_ ? content_frame_->DomWindow() : 0;
205 } 205 }
206 206
207 void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) { 207 void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) {
208 sandbox_flags_ = flags; 208 sandbox_flags_ = flags;
209 // Recalculate the container policy in case the allow-same-origin flag has 209 // Recalculate the container policy in case the allow-same-origin flag has
210 // changed. 210 // changed.
211 container_policy_ = GetContainerPolicyFromAllowedFeatures( 211 container_policy_ = GetContainerPolicyFromAllowedFeatures(
212 AllowedFeatures(), GetOriginForFeaturePolicy()); 212 AllowedFeatures(), AllowFullscreen(), AllowPaymentRequest(),
213 GetOriginForFeaturePolicy());
213 214
214 // Don't notify about updates if ContentFrame() is null, for example when 215 // Don't notify about updates if ContentFrame() is null, for example when
215 // the subframe hasn't been created yet. 216 // the subframe hasn't been created yet.
216 if (ContentFrame()) { 217 if (ContentFrame()) {
217 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( 218 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
218 ContentFrame(), sandbox_flags_, container_policy_); 219 ContentFrame(), sandbox_flags_, container_policy_);
219 } 220 }
220 } 221 }
221 222
222 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const { 223 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const {
223 return content_frame_ && HTMLElement::IsKeyboardFocusable(); 224 return content_frame_ && HTMLElement::IsKeyboardFocusable();
224 } 225 }
225 226
226 void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon( 227 void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon(
227 FrameOrPlugin* frame_or_plugin) { 228 FrameOrPlugin* frame_or_plugin) {
228 if (g_update_suspend_count) { 229 if (g_update_suspend_count) {
229 FrameOrPluginsPendingDispose().push_back(frame_or_plugin); 230 FrameOrPluginsPendingDispose().push_back(frame_or_plugin);
230 return; 231 return;
231 } 232 }
232 frame_or_plugin->Dispose(); 233 frame_or_plugin->Dispose();
233 } 234 }
234 235
235 void HTMLFrameOwnerElement::UpdateContainerPolicy() { 236 void HTMLFrameOwnerElement::UpdateContainerPolicy() {
236 container_policy_ = GetContainerPolicyFromAllowedFeatures( 237 container_policy_ = GetContainerPolicyFromAllowedFeatures(
237 AllowedFeatures(), GetOriginForFeaturePolicy()); 238 AllowedFeatures(), AllowFullscreen(), AllowPaymentRequest(),
239 GetOriginForFeaturePolicy());
238 // Don't notify about updates if ContentFrame() is null, for example when 240 // Don't notify about updates if ContentFrame() is null, for example when
239 // the subframe hasn't been created yet. 241 // the subframe hasn't been created yet.
240 if (ContentFrame()) { 242 if (ContentFrame()) {
241 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( 243 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
242 ContentFrame(), sandbox_flags_, container_policy_); 244 ContentFrame(), sandbox_flags_, container_policy_);
243 } 245 }
244 } 246 }
245 247
246 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() { 248 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() {
247 // Don't notify about updates if ContentFrame() is null, for example when 249 // Don't notify about updates if ContentFrame() is null, for example when
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 371 }
370 372
371 DEFINE_TRACE(HTMLFrameOwnerElement) { 373 DEFINE_TRACE(HTMLFrameOwnerElement) {
372 visitor->Trace(content_frame_); 374 visitor->Trace(content_frame_);
373 visitor->Trace(widget_); 375 visitor->Trace(widget_);
374 HTMLElement::Trace(visitor); 376 HTMLElement::Trace(visitor);
375 FrameOwner::Trace(visitor); 377 FrameOwner::Trace(visitor);
376 } 378 }
377 379
378 } // namespace blink 380 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698