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

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: Don't leak FeaturePolicy objects 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "core/page/FrameTree.h" 80 #include "core/page/FrameTree.h"
81 #include "core/page/Page.h" 81 #include "core/page/Page.h"
82 #include "core/page/WindowFeatures.h" 82 #include "core/page/WindowFeatures.h"
83 #include "core/page/scrolling/ScrollingCoordinator.h" 83 #include "core/page/scrolling/ScrollingCoordinator.h"
84 #include "core/svg/graphics/SVGImage.h" 84 #include "core/svg/graphics/SVGImage.h"
85 #include "core/xml/parser/XMLDocumentParser.h" 85 #include "core/xml/parser/XMLDocumentParser.h"
86 #include "platform/InstanceCounters.h" 86 #include "platform/InstanceCounters.h"
87 #include "platform/PluginScriptForbiddenScope.h" 87 #include "platform/PluginScriptForbiddenScope.h"
88 #include "platform/ScriptForbiddenScope.h" 88 #include "platform/ScriptForbiddenScope.h"
89 #include "platform/UserGestureIndicator.h" 89 #include "platform/UserGestureIndicator.h"
90 #include "platform/feature_policy/FeaturePolicy.h"
90 #include "platform/network/HTTPParsers.h" 91 #include "platform/network/HTTPParsers.h"
91 #include "platform/network/ResourceRequest.h" 92 #include "platform/network/ResourceRequest.h"
92 #include "platform/scroll/ScrollAnimatorBase.h" 93 #include "platform/scroll/ScrollAnimatorBase.h"
93 #include "platform/tracing/TraceEvent.h" 94 #include "platform/tracing/TraceEvent.h"
94 #include "platform/weborigin/SecurityOrigin.h" 95 #include "platform/weborigin/SecurityOrigin.h"
95 #include "platform/weborigin/SecurityPolicy.h" 96 #include "platform/weborigin/SecurityPolicy.h"
96 #include "platform/weborigin/Suborigin.h" 97 #include "platform/weborigin/Suborigin.h"
97 #include "public/platform/WebCachePolicy.h" 98 #include "public/platform/WebCachePolicy.h"
98 #include "public/platform/WebURLRequest.h" 99 #include "public/platform/WebURLRequest.h"
99 #include "wtf/AutoReset.h" 100 #include "wtf/AutoReset.h"
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 headerContentLanguage.stripWhiteSpace(isHTMLSpace<UChar>); 575 headerContentLanguage.stripWhiteSpace(isHTMLSpace<UChar>);
575 if (!headerContentLanguage.isEmpty()) { 576 if (!headerContentLanguage.isEmpty()) {
576 m_frame->document()->setContentLanguage( 577 m_frame->document()->setContentLanguage(
577 AtomicString(headerContentLanguage)); 578 AtomicString(headerContentLanguage));
578 } 579 }
579 } 580 }
580 581
581 OriginTrialContext::addTokensFromHeader( 582 OriginTrialContext::addTokensFromHeader(
582 m_frame->document(), 583 m_frame->document(),
583 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial)); 584 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial));
585 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
586 std::unique_ptr<FeaturePolicy> featurePolicy(
587 FeaturePolicy::createFromParentPolicy(
588 (isLoadingMainFrame()
589 ? nullptr
590 : m_frame->client()->parent()->getFeaturePolicy()),
591 m_frame->securityContext()->getSecurityOrigin()));
592 Vector<String> messages;
593 featurePolicy->setHeaderPolicy(
594 m_documentLoader->response().httpHeaderField(
595 HTTPNames::Feature_Policy),
596 messages);
597 for (auto& message : messages) {
598 m_frame->document()->addConsoleMessage(ConsoleMessage::create(
599 OtherMessageSource, ErrorMessageLevel,
600 "Error with Feature-Policy header: " + message));
601 }
602 m_frame->setFeaturePolicy(std::move(featurePolicy));
603 }
584 } 604 }
585 605
586 if (m_documentLoader) { 606 if (m_documentLoader) {
587 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField( 607 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField(
588 HTTPNames::Referrer_Policy); 608 HTTPNames::Referrer_Policy);
589 if (!referrerPolicyHeader.isNull()) { 609 if (!referrerPolicyHeader.isNull()) {
590 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader); 610 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader);
591 } 611 }
592 } 612 }
593 613
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 m_documentLoader ? m_documentLoader->url() : String()); 1958 m_documentLoader ? m_documentLoader->url() : String());
1939 return tracedValue; 1959 return tracedValue;
1940 } 1960 }
1941 1961
1942 inline void FrameLoader::takeObjectSnapshot() const { 1962 inline void FrameLoader::takeObjectSnapshot() const {
1943 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1963 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1944 toTracedValue()); 1964 toTracedValue());
1945 } 1965 }
1946 1966
1947 } // namespace blink 1967 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698