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

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

Issue 2372563002: Adding Embedding-CSP HTTP header (Closed)
Patch Set: ASCII DCHECK and a comment 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 : ErrorMessageLevel; 830 : ErrorMessageLevel;
831 if (frame()->document()) 831 if (frame()->document())
832 frame()->document()->addConsoleMessage( 832 frame()->document()->addConsoleMessage(
833 ConsoleMessage::create(JSMessageSource, level, message)); 833 ConsoleMessage::create(JSMessageSource, level, message));
834 } 834 }
835 835
836 SecurityOrigin* FrameFetchContext::getSecurityOrigin() const { 836 SecurityOrigin* FrameFetchContext::getSecurityOrigin() const {
837 return m_document ? m_document->getSecurityOrigin() : nullptr; 837 return m_document ? m_document->getSecurityOrigin() : nullptr;
838 } 838 }
839 839
840 void FrameFetchContext::upgradeInsecureRequest( 840 void FrameFetchContext::modifyRequestForCSP(ResourceRequest& resourceRequest) {
841 ResourceRequest& resourceRequest) { 841 // Record the latest requiredCSP value that will be used when sending this
842 frame()->loader().upgradeInsecureRequest(resourceRequest, m_document); 842 // request.
843 frame()->loader().recordLatestRequiredCSP();
844 frame()->loader().modifyRequestForCSP(resourceRequest, m_document);
843 } 845 }
844 846
845 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest) { 847 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest) {
846 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document) 848 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document)
847 return; 849 return;
848 850
849 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() || 851 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() ||
850 fetchRequest.clientHintsPreferences().shouldSendDPR(); 852 fetchRequest.clientHintsPreferences().shouldSendDPR();
851 bool shouldSendResourceWidth = 853 bool shouldSendResourceWidth =
852 m_document->clientHintsPreferences().shouldSendResourceWidth() || 854 m_document->clientHintsPreferences().shouldSendResourceWidth() ||
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 response); 1000 response);
999 } 1001 }
1000 1002
1001 DEFINE_TRACE(FrameFetchContext) { 1003 DEFINE_TRACE(FrameFetchContext) {
1002 visitor->trace(m_document); 1004 visitor->trace(m_document);
1003 visitor->trace(m_documentLoader); 1005 visitor->trace(m_documentLoader);
1004 FetchContext::trace(visitor); 1006 FetchContext::trace(visitor);
1005 } 1007 }
1006 1008
1007 } // namespace blink 1009 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698