| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/inspector/InspectorResourceContentLoader.h" | 6 #include "core/inspector/InspectorResourceContentLoader.h" |
| 7 | 7 |
| 8 #include "core/FetchInitiatorTypeNames.h" | 8 #include "core/FetchInitiatorTypeNames.h" |
| 9 #include "core/css/CSSStyleSheet.h" | 9 #include "core/css/CSSStyleSheet.h" |
| 10 #include "core/css/StyleSheetContents.h" | 10 #include "core/css/StyleSheetContents.h" |
| 11 #include "core/fetch/CSSStyleSheetResource.h" | 11 #include "core/fetch/CSSStyleSheetResource.h" |
| 12 #include "core/fetch/RawResource.h" | 12 #include "core/fetch/RawResource.h" |
| 13 #include "core/fetch/Resource.h" | 13 #include "core/fetch/Resource.h" |
| 14 #include "core/fetch/ResourceFetcher.h" | 14 #include "core/fetch/ResourceFetcher.h" |
| 15 #include "core/fetch/ResourcePtr.h" | 15 #include "core/fetch/ResourcePtr.h" |
| 16 #include "core/fetch/StyleSheetResourceClient.h" | 16 #include "core/fetch/StyleSheetResourceClient.h" |
| 17 #include "core/frame/LocalFrame.h" | 17 #include "core/frame/LocalFrame.h" |
| 18 #include "core/html/VoidCallback.h" | 18 #include "core/html/VoidCallback.h" |
| 19 #include "core/inspector/InspectorCSSAgent.h" | 19 #include "core/inspector/InspectorCSSAgent.h" |
| 20 #include "core/inspector/InspectorPageAgent.h" | 20 #include "core/inspector/InspectorPageAgent.h" |
| 21 #include "core/page/Page.h" | 21 #include "core/page/Page.h" |
| 22 #include "public/platform/WebURLRequest.h" | 22 #include "public/platform/WebURLRequest.h" |
| 23 | 23 |
| 24 namespace blink { | 24 namespace blink { |
| 25 | 25 |
| 26 class InspectorResourceContentLoader::ResourceClient FINAL : private RawResource
Client, private StyleSheetResourceClient { | 26 class InspectorResourceContentLoader::ResourceClient final : private RawResource
Client, private StyleSheetResourceClient { |
| 27 public: | 27 public: |
| 28 ResourceClient(InspectorResourceContentLoader* loader) | 28 ResourceClient(InspectorResourceContentLoader* loader) |
| 29 : m_loader(loader) | 29 : m_loader(loader) |
| 30 { | 30 { |
| 31 } | 31 } |
| 32 | 32 |
| 33 void waitForResource(Resource* resource) | 33 void waitForResource(Resource* resource) |
| 34 { | 34 { |
| 35 if (resource->type() == Resource::Raw) | 35 if (resource->type() == Resource::Raw) |
| 36 resource->addClient(static_cast<RawResourceClient*>(this)); | 36 resource->addClient(static_cast<RawResourceClient*>(this)); |
| 37 else | 37 else |
| 38 resource->addClient(static_cast<StyleSheetResourceClient*>(this)); | 38 resource->addClient(static_cast<StyleSheetResourceClient*>(this)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 InspectorResourceContentLoader* m_loader; | 42 InspectorResourceContentLoader* m_loader; |
| 43 | 43 |
| 44 virtual void setCSSStyleSheet(const String&, const KURL&, const String&, con
st CSSStyleSheetResource*) OVERRIDE; | 44 virtual void setCSSStyleSheet(const String&, const KURL&, const String&, con
st CSSStyleSheetResource*) override; |
| 45 virtual void notifyFinished(Resource*) OVERRIDE; | 45 virtual void notifyFinished(Resource*) override; |
| 46 void resourceFinished(Resource*); | 46 void resourceFinished(Resource*); |
| 47 | 47 |
| 48 friend class InspectorResourceContentLoader; | 48 friend class InspectorResourceContentLoader; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 void InspectorResourceContentLoader::ResourceClient::resourceFinished(Resource*
resource) | 51 void InspectorResourceContentLoader::ResourceClient::resourceFinished(Resource*
resource) |
| 52 { | 52 { |
| 53 if (m_loader) | 53 if (m_loader) |
| 54 m_loader->resourceFinished(this); | 54 m_loader->resourceFinished(this); |
| 55 | 55 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 (*it)->handleEvent(); | 195 (*it)->handleEvent(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) | 198 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) |
| 199 { | 199 { |
| 200 m_pendingResourceClients.remove(client); | 200 m_pendingResourceClients.remove(client); |
| 201 checkDone(); | 201 checkDone(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace blink | 204 } // namespace blink |
| OLD | NEW |