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

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

Issue 2481653002: Move FeaturePolicy object to SecurityContext (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/Frame.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 AtomicString(headerContentLanguage)); 572 AtomicString(headerContentLanguage));
573 } 573 }
574 } 574 }
575 575
576 OriginTrialContext::addTokensFromHeader( 576 OriginTrialContext::addTokensFromHeader(
577 m_frame->document(), 577 m_frame->document(),
578 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial)); 578 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial));
579 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { 579 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
580 std::unique_ptr<FeaturePolicy> featurePolicy( 580 std::unique_ptr<FeaturePolicy> featurePolicy(
581 FeaturePolicy::createFromParentPolicy( 581 FeaturePolicy::createFromParentPolicy(
582 (isLoadingMainFrame() 582 (isLoadingMainFrame() ? nullptr
583 ? nullptr 583 : m_frame->client()
584 : m_frame->client()->parent()->getFeaturePolicy()), 584 ->parent()
585 ->securityContext()
586 ->getFeaturePolicy()),
585 m_frame->securityContext()->getSecurityOrigin())); 587 m_frame->securityContext()->getSecurityOrigin()));
586 Vector<String> messages; 588 Vector<String> messages;
587 featurePolicy->setHeaderPolicy( 589 featurePolicy->setHeaderPolicy(
588 m_documentLoader->response().httpHeaderField( 590 m_documentLoader->response().httpHeaderField(
589 HTTPNames::Feature_Policy), 591 HTTPNames::Feature_Policy),
590 messages); 592 messages);
591 for (auto& message : messages) { 593 for (auto& message : messages) {
592 m_frame->document()->addConsoleMessage(ConsoleMessage::create( 594 m_frame->document()->addConsoleMessage(ConsoleMessage::create(
593 OtherMessageSource, ErrorMessageLevel, 595 OtherMessageSource, ErrorMessageLevel,
594 "Error with Feature-Policy header: " + message)); 596 "Error with Feature-Policy header: " + message));
595 } 597 }
596 m_frame->setFeaturePolicy(std::move(featurePolicy)); 598 m_frame->document()->setFeaturePolicy(std::move(featurePolicy));
597 } 599 }
598 } 600 }
599 601
600 if (m_documentLoader) { 602 if (m_documentLoader) {
601 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField( 603 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField(
602 HTTPNames::Referrer_Policy); 604 HTTPNames::Referrer_Policy);
603 if (!referrerPolicyHeader.isNull()) { 605 if (!referrerPolicyHeader.isNull()) {
604 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader); 606 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader);
605 } 607 }
606 } 608 }
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 m_documentLoader ? m_documentLoader->url() : String()); 1947 m_documentLoader ? m_documentLoader->url() : String());
1946 return tracedValue; 1948 return tracedValue;
1947 } 1949 }
1948 1950
1949 inline void FrameLoader::takeObjectSnapshot() const { 1951 inline void FrameLoader::takeObjectSnapshot() const {
1950 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1952 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1951 toTracedValue()); 1953 toTracedValue());
1952 } 1954 }
1953 1955
1954 } // namespace blink 1956 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/Frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698