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

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: Remove overaggressive bool transform Created 4 years, 3 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, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/PluginScriptForbiddenScope.h" 86 #include "platform/PluginScriptForbiddenScope.h"
87 #include "platform/RuntimeEnabledFeatures.h" 87 #include "platform/RuntimeEnabledFeatures.h"
88 #include "platform/ScriptForbiddenScope.h" 88 #include "platform/ScriptForbiddenScope.h"
89 #include "platform/TraceEvent.h" 89 #include "platform/TraceEvent.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/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"
100 #include "wtf/text/CString.h" 101 #include "wtf/text/CString.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 String headerContentLanguage = m_documentLoader->response().httpHeaderFi eld(HTTPNames::Content_Language); 517 String headerContentLanguage = m_documentLoader->response().httpHeaderFi eld(HTTPNames::Content_Language);
517 if (!headerContentLanguage.isEmpty()) { 518 if (!headerContentLanguage.isEmpty()) {
518 size_t commaIndex = headerContentLanguage.find(','); 519 size_t commaIndex = headerContentLanguage.find(',');
519 headerContentLanguage.truncate(commaIndex); // kNotFound == -1 == do n't truncate 520 headerContentLanguage.truncate(commaIndex); // kNotFound == -1 == do n't truncate
520 headerContentLanguage = headerContentLanguage.stripWhiteSpace(isHTML Space<UChar>); 521 headerContentLanguage = headerContentLanguage.stripWhiteSpace(isHTML Space<UChar>);
521 if (!headerContentLanguage.isEmpty()) 522 if (!headerContentLanguage.isEmpty())
522 m_frame->document()->setContentLanguage(AtomicString(headerConte ntLanguage)); 523 m_frame->document()->setContentLanguage(AtomicString(headerConte ntLanguage));
523 } 524 }
524 525
525 OriginTrialContext::addTokensFromHeader(m_frame->document(), m_documentL oader->response().httpHeaderField(HTTPNames::Origin_Trial)); 526 OriginTrialContext::addTokensFromHeader(m_frame->document(), m_documentL oader->response().httpHeaderField(HTTPNames::Origin_Trial));
527 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
528 FeaturePolicy* featurePolicy;
529 if (!isLoadingMainFrame()) {
lunalu1 2016/09/20 14:55:49 Personal preference: FeaturePolicy::createFromPare
iclelland 2016/10/14 19:37:49 Done (except that I omitted the "!" and swapped th
530 featurePolicy = FeaturePolicy::createFromParentPolicy(m_frame->c lient()->parent()->getFeaturePolicy(), m_frame->securityContext()->getSecurityOr igin());
531 } else {
532 featurePolicy = FeaturePolicy::createFromParentPolicy(nullptr, m _frame->securityContext()->getSecurityOrigin());
533 }
534 featurePolicy->addPolicyFromString(m_documentLoader->response().http HeaderField(HTTPNames::Feature_Policy));
535 m_frame->setFeaturePolicy(featurePolicy);
536 }
526 } 537 }
527 538
528 if (m_documentLoader && RuntimeEnabledFeatures::referrerPolicyHeaderEnabled( )) { 539 if (m_documentLoader && RuntimeEnabledFeatures::referrerPolicyHeaderEnabled( )) {
529 String referrerPolicyHeader = m_documentLoader->response().httpHeaderFie ld(HTTPNames::Referrer_Policy); 540 String referrerPolicyHeader = m_documentLoader->response().httpHeaderFie ld(HTTPNames::Referrer_Policy);
530 if (!referrerPolicyHeader.isNull()) { 541 if (!referrerPolicyHeader.isNull()) {
531 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader) ; 542 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader) ;
532 } 543 }
533 } 544 }
534 545
535 client()->didCreateNewDocument(); 546 client()->didCreateNewDocument();
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1626 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1616 return tracedValue; 1627 return tracedValue;
1617 } 1628 }
1618 1629
1619 inline void FrameLoader::takeObjectSnapshot() const 1630 inline void FrameLoader::takeObjectSnapshot() const
1620 { 1631 {
1621 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1632 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1622 } 1633 }
1623 1634
1624 } // namespace blink 1635 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698