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

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

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

Powered by Google App Engine
This is Rietveld 408576698