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

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

Issue 2923563003: Move container policy logic to frame owner classes. (Closed)
Patch Set: Addressing nits Created 3 years, 6 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
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_ = ConstructContainerPolicy();
212 AllowedFeatures(), AllowFullscreen(), AllowPaymentRequest(),
213 GetOriginForFeaturePolicy());
214 212
215 // Don't notify about updates if ContentFrame() is null, for example when 213 // Don't notify about updates if ContentFrame() is null, for example when
216 // the subframe hasn't been created yet. 214 // the subframe hasn't been created yet.
217 if (ContentFrame()) { 215 if (ContentFrame()) {
218 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( 216 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
219 ContentFrame(), sandbox_flags_, container_policy_); 217 ContentFrame(), sandbox_flags_, container_policy_);
220 } 218 }
221 } 219 }
222 220
223 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const { 221 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const {
224 return content_frame_ && HTMLElement::IsKeyboardFocusable(); 222 return content_frame_ && HTMLElement::IsKeyboardFocusable();
225 } 223 }
226 224
227 void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon( 225 void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon(
228 FrameOrPlugin* frame_or_plugin) { 226 FrameOrPlugin* frame_or_plugin) {
229 if (g_update_suspend_count) { 227 if (g_update_suspend_count) {
230 FrameOrPluginsPendingDispose().insert(frame_or_plugin); 228 FrameOrPluginsPendingDispose().insert(frame_or_plugin);
231 } else { 229 } else {
232 frame_or_plugin->Dispose(); 230 frame_or_plugin->Dispose();
233 } 231 }
234 } 232 }
235 233
236 void HTMLFrameOwnerElement::UpdateContainerPolicy() { 234 void HTMLFrameOwnerElement::UpdateContainerPolicy() {
237 container_policy_ = GetContainerPolicyFromAllowedFeatures( 235 container_policy_ = ConstructContainerPolicy();
238 AllowedFeatures(), AllowFullscreen(), AllowPaymentRequest(),
239 GetOriginForFeaturePolicy());
240 // Don't notify about updates if ContentFrame() is null, for example when 236 // Don't notify about updates if ContentFrame() is null, for example when
241 // the subframe hasn't been created yet. 237 // the subframe hasn't been created yet.
242 if (ContentFrame()) { 238 if (ContentFrame()) {
243 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( 239 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
244 ContentFrame(), sandbox_flags_, container_policy_); 240 ContentFrame(), sandbox_flags_, container_policy_);
245 } 241 }
246 } 242 }
247 243
248 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() { 244 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() {
249 // Don't notify about updates if ContentFrame() is null, for example when 245 // Don't notify about updates if ContentFrame() is null, for example when
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 357 }
362 358
363 DEFINE_TRACE(HTMLFrameOwnerElement) { 359 DEFINE_TRACE(HTMLFrameOwnerElement) {
364 visitor->Trace(content_frame_); 360 visitor->Trace(content_frame_);
365 visitor->Trace(widget_); 361 visitor->Trace(widget_);
366 HTMLElement::Trace(visitor); 362 HTMLElement::Trace(visitor);
367 FrameOwner::Trace(visitor); 363 FrameOwner::Trace(visitor);
368 } 364 }
369 365
370 } // namespace blink 366 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h ('k') | third_party/WebKit/Source/core/html/HTMLIFrameElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698