| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/inspector/InspectorResourceContentLoader.h" | 5 #include "core/inspector/InspectorResourceContentLoader.h" |
| 6 | 6 |
| 7 #include "core/css/CSSStyleSheet.h" | 7 #include "core/css/CSSStyleSheet.h" |
| 8 #include "core/css/StyleSheetContents.h" | 8 #include "core/css/StyleSheetContents.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/inspector/InspectedFrames.h" | 11 #include "core/inspector/InspectedFrames.h" |
| 12 #include "core/inspector/InspectorCSSAgent.h" | 12 #include "core/inspector/InspectorCSSAgent.h" |
| 13 #include "core/inspector/InspectorPageAgent.h" | 13 #include "core/inspector/InspectorPageAgent.h" |
| 14 #include "core/loader/DocumentLoader.h" |
| 14 #include "core/loader/resource/CSSStyleSheetResource.h" | 15 #include "core/loader/resource/CSSStyleSheetResource.h" |
| 15 #include "core/loader/resource/StyleSheetResourceClient.h" | 16 #include "core/loader/resource/StyleSheetResourceClient.h" |
| 16 #include "core/page/Page.h" | 17 #include "core/page/Page.h" |
| 17 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" | 18 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" |
| 18 #include "platform/loader/fetch/RawResource.h" | 19 #include "platform/loader/fetch/RawResource.h" |
| 19 #include "platform/loader/fetch/Resource.h" | 20 #include "platform/loader/fetch/Resource.h" |
| 20 #include "platform/loader/fetch/ResourceFetcher.h" | 21 #include "platform/loader/fetch/ResourceFetcher.h" |
| 21 #include "public/platform/WebCachePolicy.h" | 22 #include "public/platform/WebCachePolicy.h" |
| 22 #include "public/platform/WebURLRequest.h" | 23 #include "public/platform/WebURLRequest.h" |
| 23 | 24 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 InspectedFrames* inspectedFrames = InspectedFrames::create(m_inspectedFrame); | 105 InspectedFrames* inspectedFrames = InspectedFrames::create(m_inspectedFrame); |
| 105 for (LocalFrame* frame : *inspectedFrames) { | 106 for (LocalFrame* frame : *inspectedFrames) { |
| 106 documents.push_back(frame->document()); | 107 documents.push_back(frame->document()); |
| 107 documents.appendVector(InspectorPageAgent::importsForFrame(frame)); | 108 documents.appendVector(InspectorPageAgent::importsForFrame(frame)); |
| 108 } | 109 } |
| 109 for (Document* document : documents) { | 110 for (Document* document : documents) { |
| 110 HashSet<String> urlsToFetch; | 111 HashSet<String> urlsToFetch; |
| 111 | 112 |
| 112 ResourceRequest resourceRequest; | 113 ResourceRequest resourceRequest; |
| 113 HistoryItem* item = | 114 HistoryItem* item = |
| 114 document->frame() ? document->frame()->loader().currentItem() : nullptr; | 115 document->loader() ? document->loader()->historyItem() : nullptr; |
| 115 if (item) { | 116 if (item) { |
| 116 resourceRequest = FrameLoader::resourceRequestFromHistoryItem( | 117 resourceRequest = item->generateResourceRequest( |
| 117 item, WebCachePolicy::ReturnCacheDataDontLoad); | 118 WebCachePolicy::ReturnCacheDataDontLoad); |
| 118 } else { | 119 } else { |
| 119 resourceRequest = document->url(); | 120 resourceRequest = document->url(); |
| 120 resourceRequest.setCachePolicy(WebCachePolicy::ReturnCacheDataDontLoad); | 121 resourceRequest.setCachePolicy(WebCachePolicy::ReturnCacheDataDontLoad); |
| 121 } | 122 } |
| 122 resourceRequest.setRequestContext(WebURLRequest::RequestContextInternal); | 123 resourceRequest.setRequestContext(WebURLRequest::RequestContextInternal); |
| 123 | 124 |
| 124 if (!resourceRequest.url().getString().isEmpty()) { | 125 if (!resourceRequest.url().getString().isEmpty()) { |
| 125 urlsToFetch.insert(resourceRequest.url().getString()); | 126 urlsToFetch.insert(resourceRequest.url().getString()); |
| 126 FetchRequest request(resourceRequest, FetchInitiatorTypeNames::internal); | 127 FetchRequest request(resourceRequest, FetchInitiatorTypeNames::internal); |
| 127 Resource* resource = RawResource::fetch(request, document->fetcher()); | 128 Resource* resource = RawResource::fetch(request, document->fetcher()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 (*callback)(); | 227 (*callback)(); |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 | 230 |
| 230 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) { | 231 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) { |
| 231 m_pendingResourceClients.erase(client); | 232 m_pendingResourceClients.erase(client); |
| 232 checkDone(); | 233 checkDone(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 } // namespace blink | 236 } // namespace blink |
| OLD | NEW |