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

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

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Duplicate FP object rather than modifying in-place 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 /* 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 if (!headerContentLanguage.isEmpty()) { 577 if (!headerContentLanguage.isEmpty()) {
578 m_frame->document()->setContentLanguage( 578 m_frame->document()->setContentLanguage(
579 AtomicString(headerContentLanguage)); 579 AtomicString(headerContentLanguage));
580 } 580 }
581 } 581 }
582 582
583 OriginTrialContext::addTokensFromHeader( 583 OriginTrialContext::addTokensFromHeader(
584 m_frame->document(), 584 m_frame->document(),
585 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial)); 585 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial));
586 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { 586 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
587 FeaturePolicy* parentFeaturePolicy = 587 WebFeaturePolicy* parentFeaturePolicy =
588 (isLoadingMainFrame() ? nullptr 588 (isLoadingMainFrame() ? nullptr
589 : m_frame->client() 589 : m_frame->client()
590 ->parent() 590 ->parent()
591 ->securityContext() 591 ->securityContext()
592 ->getFeaturePolicy()); 592 ->getFeaturePolicy());
593 const String& featurePolicyHeader = 593 const String& featurePolicyHeader =
594 m_documentLoader->response().httpHeaderField( 594 m_documentLoader->response().httpHeaderField(
595 HTTPNames::Feature_Policy); 595 HTTPNames::Feature_Policy);
596 Vector<String> messages; 596 Vector<String> messages;
597 const WebParsedFeaturePolicyHeader& parsedHeader = 597 const WebParsedFeaturePolicyHeader& parsedHeader =
598 FeaturePolicy::parseFeaturePolicy( 598 FeaturePolicy::parseFeaturePolicy(
599 featurePolicyHeader, 599 featurePolicyHeader,
600 m_frame->securityContext()->getSecurityOrigin(), &messages); 600 m_frame->securityContext()->getSecurityOrigin(), &messages);
601 m_frame->securityContext()->setFeaturePolicyFromHeader( 601 m_frame->securityContext()->initializeFeaturePolicy(parsedHeader,
602 parsedHeader, parentFeaturePolicy); 602 parentFeaturePolicy);
603 for (auto& message : messages) { 603 for (auto& message : messages) {
604 m_frame->document()->addConsoleMessage(ConsoleMessage::create( 604 m_frame->document()->addConsoleMessage(ConsoleMessage::create(
605 OtherMessageSource, ErrorMessageLevel, 605 OtherMessageSource, ErrorMessageLevel,
606 "Error with Feature-Policy header: " + message)); 606 "Error with Feature-Policy header: " + message));
607 } 607 }
608 if (!parsedHeader.isEmpty()) 608 if (!parsedHeader.isEmpty())
609 client()->didSetFeaturePolicyHeader(parsedHeader); 609 client()->didSetFeaturePolicyHeader(parsedHeader);
610 } 610 }
611 } 611 }
612 612
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 m_isNavigationHandledByClient = true; 2036 m_isNavigationHandledByClient = true;
2037 InspectorInstrumentation::frameScheduledClientNavigation(m_frame); 2037 InspectorInstrumentation::frameScheduledClientNavigation(m_frame);
2038 } 2038 }
2039 2039
2040 void FrameLoader::clearNavigationHandledByClient() { 2040 void FrameLoader::clearNavigationHandledByClient() {
2041 m_isNavigationHandledByClient = false; 2041 m_isNavigationHandledByClient = false;
2042 InspectorInstrumentation::frameClearedScheduledClientNavigation(m_frame); 2042 InspectorInstrumentation::frameClearedScheduledClientNavigation(m_frame);
2043 } 2043 }
2044 2044
2045 } // namespace blink 2045 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698