OLD | NEW |
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq
uest& request, const ResourceResponse& response) | 216 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq
uest& request, const ResourceResponse& response) |
217 { | 217 { |
218 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
response); | 218 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
response); |
219 } | 219 } |
220 | 220 |
221 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, ResourceLoader* resourceLoader) | 221 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, ResourceLoader* resourceLoader) |
222 { | 222 { |
223 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); | 223 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); |
224 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), frame()->do
cument()); | 224 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), frame()->do
cument()); |
225 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) | 225 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { |
226 handleAcceptClientHintsHeader(response.httpHeaderField("accept-ch"), m_d
ocumentLoader->clientHintsPreferences()); | 226 ResourceFetcher* fetcher = nullptr; |
| 227 if (frame()->document()) |
| 228 fetcher = frame()->document()->fetcher(); |
| 229 handleAcceptClientHintsHeader(response.httpHeaderField("accept-ch"), m_d
ocumentLoader->clientHintsPreferences(), fetcher); |
| 230 } |
227 | 231 |
228 frame()->loader().progress().incrementProgress(identifier, response); | 232 frame()->loader().progress().incrementProgress(identifier, response); |
229 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide
ntifier, response); | 233 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide
ntifier, response); |
230 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E
VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame
(), response)); | 234 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E
VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame
(), response)); |
231 DocumentLoader* documentLoader = ensureLoaderForNotifications(); | 235 DocumentLoader* documentLoader = ensureLoaderForNotifications(); |
232 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do
cumentLoader, response, resourceLoader); | 236 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do
cumentLoader, response, resourceLoader); |
233 // It is essential that inspector gets resource response BEFORE console. | 237 // It is essential that inspector gets resource response BEFORE console. |
234 frame()->console().reportResourceResponseReceived(documentLoader, identifier
, response); | 238 frame()->console().reportResourceResponseReceived(documentLoader, identifier
, response); |
235 } | 239 } |
236 | 240 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques
t& fetchRequest) | 634 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques
t& fetchRequest) |
631 { | 635 { |
632 if (!m_document) | 636 if (!m_document) |
633 return; | 637 return; |
634 | 638 |
635 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy(); | 639 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy(); |
636 if (csp->shouldSendCSPHeader(type)) | 640 if (csp->shouldSendCSPHeader(type)) |
637 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active"
); | 641 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active"
); |
638 } | 642 } |
639 | 643 |
| 644 void FrameFetchContext::countClientHintsDPR() |
| 645 { |
| 646 UseCounter::count(frame(), UseCounter::ClientHintsDPR); |
| 647 } |
| 648 |
| 649 void FrameFetchContext::countClientHintsResourceWidth() |
| 650 { |
| 651 UseCounter::count(frame(), UseCounter::ClientHintsResourceWidth); |
| 652 } |
| 653 |
| 654 void FrameFetchContext::countClientHintsViewportWidth() |
| 655 { |
| 656 UseCounter::count(frame(), UseCounter::ClientHintsViewportWidth); |
| 657 } |
| 658 |
640 DEFINE_TRACE(FrameFetchContext) | 659 DEFINE_TRACE(FrameFetchContext) |
641 { | 660 { |
642 visitor->trace(m_document); | 661 visitor->trace(m_document); |
643 FetchContext::trace(visitor); | 662 FetchContext::trace(visitor); |
644 } | 663 } |
645 | 664 |
646 } // namespace blink | 665 } // namespace blink |
OLD | NEW |