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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2254533002: [FeaturePolicy] Initial implementation of Feature Policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fp-flag
Patch Set: Addressing nits Created 4 years, 1 month 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, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 #include "core/page/FrameTree.h" 81 #include "core/page/FrameTree.h"
82 #include "core/page/Page.h" 82 #include "core/page/Page.h"
83 #include "core/page/WindowFeatures.h" 83 #include "core/page/WindowFeatures.h"
84 #include "core/page/scrolling/ScrollingCoordinator.h" 84 #include "core/page/scrolling/ScrollingCoordinator.h"
85 #include "core/svg/graphics/SVGImage.h" 85 #include "core/svg/graphics/SVGImage.h"
86 #include "core/xml/parser/XMLDocumentParser.h" 86 #include "core/xml/parser/XMLDocumentParser.h"
87 #include "platform/InstanceCounters.h" 87 #include "platform/InstanceCounters.h"
88 #include "platform/PluginScriptForbiddenScope.h" 88 #include "platform/PluginScriptForbiddenScope.h"
89 #include "platform/ScriptForbiddenScope.h" 89 #include "platform/ScriptForbiddenScope.h"
90 #include "platform/UserGestureIndicator.h" 90 #include "platform/UserGestureIndicator.h"
91 #include "platform/feature_policy/FeaturePolicy.h"
91 #include "platform/network/HTTPParsers.h" 92 #include "platform/network/HTTPParsers.h"
92 #include "platform/network/ResourceRequest.h" 93 #include "platform/network/ResourceRequest.h"
93 #include "platform/scroll/ScrollAnimatorBase.h" 94 #include "platform/scroll/ScrollAnimatorBase.h"
94 #include "platform/tracing/TraceEvent.h" 95 #include "platform/tracing/TraceEvent.h"
95 #include "platform/weborigin/SecurityOrigin.h" 96 #include "platform/weborigin/SecurityOrigin.h"
96 #include "platform/weborigin/SecurityPolicy.h" 97 #include "platform/weborigin/SecurityPolicy.h"
97 #include "platform/weborigin/Suborigin.h" 98 #include "platform/weborigin/Suborigin.h"
98 #include "public/platform/WebCachePolicy.h" 99 #include "public/platform/WebCachePolicy.h"
99 #include "public/platform/WebURLRequest.h" 100 #include "public/platform/WebURLRequest.h"
100 #include "wtf/AutoReset.h" 101 #include "wtf/AutoReset.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 headerContentLanguage.stripWhiteSpace(isHTMLSpace<UChar>); 569 headerContentLanguage.stripWhiteSpace(isHTMLSpace<UChar>);
569 if (!headerContentLanguage.isEmpty()) { 570 if (!headerContentLanguage.isEmpty()) {
570 m_frame->document()->setContentLanguage( 571 m_frame->document()->setContentLanguage(
571 AtomicString(headerContentLanguage)); 572 AtomicString(headerContentLanguage));
572 } 573 }
573 } 574 }
574 575
575 OriginTrialContext::addTokensFromHeader( 576 OriginTrialContext::addTokensFromHeader(
576 m_frame->document(), 577 m_frame->document(),
577 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial)); 578 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial));
579 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
580 std::unique_ptr<FeaturePolicy> featurePolicy(
581 FeaturePolicy::createFromParentPolicy(
582 (isLoadingMainFrame()
583 ? nullptr
584 : m_frame->client()->parent()->getFeaturePolicy()),
585 m_frame->securityContext()->getSecurityOrigin()));
586 Vector<String> messages;
587 featurePolicy->setHeaderPolicy(
588 m_documentLoader->response().httpHeaderField(
589 HTTPNames::Feature_Policy),
590 messages);
591 for (auto& message : messages) {
592 m_frame->document()->addConsoleMessage(ConsoleMessage::create(
593 OtherMessageSource, ErrorMessageLevel,
594 "Error with Feature-Policy header: " + message));
595 }
596 m_frame->setFeaturePolicy(std::move(featurePolicy));
597 }
578 } 598 }
579 599
580 if (m_documentLoader) { 600 if (m_documentLoader) {
581 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField( 601 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField(
582 HTTPNames::Referrer_Policy); 602 HTTPNames::Referrer_Policy);
583 if (!referrerPolicyHeader.isNull()) { 603 if (!referrerPolicyHeader.isNull()) {
584 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader); 604 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader);
585 } 605 }
586 } 606 }
587 607
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 m_documentLoader ? m_documentLoader->url() : String()); 1947 m_documentLoader ? m_documentLoader->url() : String());
1928 return tracedValue; 1948 return tracedValue;
1929 } 1949 }
1930 1950
1931 inline void FrameLoader::takeObjectSnapshot() const { 1951 inline void FrameLoader::takeObjectSnapshot() const {
1932 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1952 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1933 toTracedValue()); 1953 toTracedValue());
1934 } 1954 }
1935 1955
1936 } // namespace blink 1956 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/Frame.cpp ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698