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

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

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: DCHECK. Created 4 years 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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 return m_document ? m_document->getSecurityOrigin() : nullptr; 862 return m_document ? m_document->getSecurityOrigin() : nullptr;
863 } 863 }
864 864
865 void FrameFetchContext::modifyRequestForCSP(ResourceRequest& resourceRequest) { 865 void FrameFetchContext::modifyRequestForCSP(ResourceRequest& resourceRequest) {
866 // Record the latest requiredCSP value that will be used when sending this 866 // Record the latest requiredCSP value that will be used when sending this
867 // request. 867 // request.
868 frame()->loader().recordLatestRequiredCSP(); 868 frame()->loader().recordLatestRequiredCSP();
869 frame()->loader().modifyRequestForCSP(resourceRequest, m_document); 869 frame()->loader().modifyRequestForCSP(resourceRequest, m_document);
870 } 870 }
871 871
872 WebInsecureRequestPolicy FrameFetchContext::getInsecureRequestPolicy() const {
873 // If no document is present (during frame navigation, for instance), use the
874 // FrameLoader's policy.
875 return m_document ? m_document->getInsecureRequestPolicy()
876 : frame()->loader().getInsecureRequestPolicy();
877 }
878
872 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest) { 879 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest) {
873 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document) 880 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document)
874 return; 881 return;
875 882
876 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() || 883 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() ||
877 fetchRequest.clientHintsPreferences().shouldSendDPR(); 884 fetchRequest.clientHintsPreferences().shouldSendDPR();
878 bool shouldSendResourceWidth = 885 bool shouldSendResourceWidth =
879 m_document->clientHintsPreferences().shouldSendResourceWidth() || 886 m_document->clientHintsPreferences().shouldSendResourceWidth() ||
880 fetchRequest.clientHintsPreferences().shouldSendResourceWidth(); 887 fetchRequest.clientHintsPreferences().shouldSendResourceWidth();
881 bool shouldSendViewportWidth = 888 bool shouldSendViewportWidth =
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 response); 1021 response);
1015 } 1022 }
1016 1023
1017 DEFINE_TRACE(FrameFetchContext) { 1024 DEFINE_TRACE(FrameFetchContext) {
1018 visitor->trace(m_document); 1025 visitor->trace(m_document);
1019 visitor->trace(m_documentLoader); 1026 visitor->trace(m_documentLoader);
1020 FetchContext::trace(visitor); 1027 FetchContext::trace(visitor);
1021 } 1028 }
1022 1029
1023 } // namespace blink 1030 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698