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

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

Issue 2372563002: Adding Embedding-CSP HTTP header (Closed)
Patch Set: Separating into two functions Created 4 years, 2 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 MessageLevel level = messageType == LogWarningMessage ? WarningMessageLevel : ErrorMessageLevel; 691 MessageLevel level = messageType == LogWarningMessage ? WarningMessageLevel : ErrorMessageLevel;
692 if (frame()->document()) 692 if (frame()->document())
693 frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMessageS ource, level, message)); 693 frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMessageS ource, level, message));
694 } 694 }
695 695
696 SecurityOrigin* FrameFetchContext::getSecurityOrigin() const 696 SecurityOrigin* FrameFetchContext::getSecurityOrigin() const
697 { 697 {
698 return m_document ? m_document->getSecurityOrigin() : nullptr; 698 return m_document ? m_document->getSecurityOrigin() : nullptr;
699 } 699 }
700 700
701 void FrameFetchContext::upgradeInsecureRequest(ResourceRequest& resourceRequest) 701 void FrameFetchContext::addOutgoingSecurityHeadersAndUpgradeRequest(ResourceRequ est& resourceRequest)
702 { 702 {
703 frame()->loader().upgradeInsecureRequest(resourceRequest, m_document); 703 // Record the latest requiredCSP value that will be used when sending this r equest.
704 frame()->loader().recordLatestRequiredCSP();
705 frame()->loader().addOutgoingSecurityHeadersAndUpgradeRequest(resourceReques t, m_document);
704 } 706 }
705 707
706 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest) 708 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest)
707 { 709 {
708 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document) 710 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document)
709 return; 711 return;
710 712
711 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() || fetchRequest.clientHintsPreferences().shouldSendDPR(); 713 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() || fetchRequest.clientHintsPreferences().shouldSendDPR();
712 bool shouldSendResourceWidth = m_document->clientHintsPreferences().shouldSe ndResourceWidth() || fetchRequest.clientHintsPreferences().shouldSendResourceWid th(); 714 bool shouldSendResourceWidth = m_document->clientHintsPreferences().shouldSe ndResourceWidth() || fetchRequest.clientHintsPreferences().shouldSendResourceWid th();
713 bool shouldSendViewportWidth = m_document->clientHintsPreferences().shouldSe ndViewportWidth() || fetchRequest.clientHintsPreferences().shouldSendViewportWid th(); 715 bool shouldSendViewportWidth = m_document->clientHintsPreferences().shouldSe ndViewportWidth() || fetchRequest.clientHintsPreferences().shouldSendViewportWid th();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 } 835 }
834 836
835 DEFINE_TRACE(FrameFetchContext) 837 DEFINE_TRACE(FrameFetchContext)
836 { 838 {
837 visitor->trace(m_document); 839 visitor->trace(m_document);
838 visitor->trace(m_documentLoader); 840 visitor->trace(m_documentLoader);
839 FetchContext::trace(visitor); 841 FetchContext::trace(visitor);
840 } 842 }
841 843
842 } // namespace blink 844 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698