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

Side by Side Diff: third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp

Issue 2739203002: Initial Implementation of Iframe Attribute for Feature Policy (Part 3) (Closed)
Patch Set: Created 3 years, 9 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/WebRemoteFrameImpl.h" 5 #include "web/WebRemoteFrameImpl.h"
6 6
7 #include <v8/include/v8.h>
7 #include "core/dom/Fullscreen.h" 8 #include "core/dom/Fullscreen.h"
8 #include "core/dom/RemoteSecurityContext.h" 9 #include "core/dom/RemoteSecurityContext.h"
9 #include "core/dom/SecurityContext.h" 10 #include "core/dom/SecurityContext.h"
10 #include "core/frame/FrameView.h" 11 #include "core/frame/FrameView.h"
11 #include "core/frame/Settings.h" 12 #include "core/frame/Settings.h"
12 #include "core/frame/csp/ContentSecurityPolicy.h" 13 #include "core/frame/csp/ContentSecurityPolicy.h"
13 #include "core/html/HTMLFrameOwnerElement.h" 14 #include "core/html/HTMLFrameOwnerElement.h"
14 #include "core/layout/LayoutObject.h" 15 #include "core/layout/LayoutObject.h"
15 #include "core/page/Page.h" 16 #include "core/page/Page.h"
17 #include "platform/feature_policy/FeaturePolicy.h"
16 #include "platform/heap/Handle.h" 18 #include "platform/heap/Handle.h"
17 #include "public/platform/WebFeaturePolicy.h" 19 #include "public/platform/WebFeaturePolicy.h"
18 #include "public/platform/WebFloatRect.h" 20 #include "public/platform/WebFloatRect.h"
19 #include "public/platform/WebRect.h" 21 #include "public/platform/WebRect.h"
20 #include "public/web/WebDocument.h" 22 #include "public/web/WebDocument.h"
21 #include "public/web/WebFrameOwnerProperties.h" 23 #include "public/web/WebFrameOwnerProperties.h"
22 #include "public/web/WebPerformance.h" 24 #include "public/web/WebPerformance.h"
23 #include "public/web/WebRange.h" 25 #include "public/web/WebRange.h"
24 #include "public/web/WebTreeScopeType.h" 26 #include "public/web/WebTreeScopeType.h"
25 #include "web/RemoteFrameOwner.h" 27 #include "web/RemoteFrameOwner.h"
26 #include "web/WebLocalFrameImpl.h" 28 #include "web/WebLocalFrameImpl.h"
27 #include "web/WebViewImpl.h" 29 #include "web/WebViewImpl.h"
28 #include <v8/include/v8.h>
29 30
30 namespace blink { 31 namespace blink {
31 32
32 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, 33 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope,
33 WebRemoteFrameClient* client, 34 WebRemoteFrameClient* client,
34 WebFrame* opener) { 35 WebFrame* opener) {
35 return WebRemoteFrameImpl::create(scope, client, opener); 36 return WebRemoteFrameImpl::create(scope, client, opener);
36 } 37 }
37 38
38 WebRemoteFrameImpl* WebRemoteFrameImpl::create(WebTreeScopeType scope, 39 WebRemoteFrameImpl* WebRemoteFrameImpl::create(WebTreeScopeType scope,
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 static_cast<SandboxFlags>(flags)); 421 static_cast<SandboxFlags>(flags));
421 } 422 }
422 423
423 void WebRemoteFrameImpl::setReplicatedName(const WebString& name, 424 void WebRemoteFrameImpl::setReplicatedName(const WebString& name,
424 const WebString& uniqueName) const { 425 const WebString& uniqueName) const {
425 DCHECK(frame()); 426 DCHECK(frame());
426 frame()->tree().setPrecalculatedName(name, uniqueName); 427 frame()->tree().setPrecalculatedName(name, uniqueName);
427 } 428 }
428 429
429 void WebRemoteFrameImpl::setReplicatedFeaturePolicyHeader( 430 void WebRemoteFrameImpl::setReplicatedFeaturePolicyHeader(
430 const WebParsedFeaturePolicyHeader& parsedHeader) const { 431 const WebParsedFeaturePolicy& parsedHeader) const {
431 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { 432 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
432 WebFeaturePolicy* parentFeaturePolicy = nullptr; 433 WebFeaturePolicy* parentFeaturePolicy = nullptr;
433 if (parent()) { 434 if (parent()) {
434 Frame* parentFrame = frame()->client()->parent(); 435 Frame* parentFrame = frame()->client()->parent();
435 parentFeaturePolicy = parentFrame->securityContext()->getFeaturePolicy(); 436 parentFeaturePolicy = parentFrame->securityContext()->getFeaturePolicy();
436 } 437 }
437 frame()->securityContext()->initializeFeaturePolicy(parsedHeader, 438 const WebParsedFeaturePolicy containerPolicy =
438 parentFeaturePolicy); 439 getContainerPolicyFromAllowedFeatures(
440 frame()->owner()->allowedFeatures(),
441 frame()->securityContext()->getSecurityOrigin());
442 frame()->securityContext()->initializeFeaturePolicy(
443 parsedHeader, containerPolicy, parentFeaturePolicy);
439 } 444 }
440 } 445 }
441 446
442 void WebRemoteFrameImpl::addReplicatedContentSecurityPolicyHeader( 447 void WebRemoteFrameImpl::addReplicatedContentSecurityPolicyHeader(
443 const WebString& headerValue, 448 const WebString& headerValue,
444 WebContentSecurityPolicyType type, 449 WebContentSecurityPolicyType type,
445 WebContentSecurityPolicySource source) const { 450 WebContentSecurityPolicySource source) const {
446 frame()->securityContext()->contentSecurityPolicy()->addPolicyFromHeaderValue( 451 frame()->securityContext()->contentSecurityPolicy()->addPolicyFromHeaderValue(
447 headerValue, static_cast<ContentSecurityPolicyHeaderType>(type), 452 headerValue, static_cast<ContentSecurityPolicyHeaderType>(type),
448 static_cast<ContentSecurityPolicyHeaderSource>(source)); 453 static_cast<ContentSecurityPolicyHeaderSource>(source));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 533 }
529 534
530 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope, 535 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope,
531 WebRemoteFrameClient* client) 536 WebRemoteFrameClient* client)
532 : WebRemoteFrame(scope), 537 : WebRemoteFrame(scope),
533 m_frameClient(RemoteFrameClientImpl::create(this)), 538 m_frameClient(RemoteFrameClientImpl::create(this)),
534 m_client(client), 539 m_client(client),
535 m_selfKeepAlive(this) {} 540 m_selfKeepAlive(this) {}
536 541
537 } // namespace blink 542 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698