| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef SubresourceFilter_h | 5 #ifndef SubresourceFilter_h |
| 6 #define SubresourceFilter_h | 6 #define SubresourceFilter_h |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "platform/weborigin/SecurityViolationReportingPolicy.h" | 12 #include "platform/weborigin/SecurityViolationReportingPolicy.h" |
| 13 #include "public/platform/WebDocumentSubresourceFilter.h" |
| 13 #include "public/platform/WebURLRequest.h" | 14 #include "public/platform/WebURLRequest.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class DocumentLoader; | 18 class DocumentLoader; |
| 18 class KURL; | 19 class KURL; |
| 19 class WebDocumentSubresourceFilter; | |
| 20 | 20 |
| 21 // Wrapper around a WebDocumentSubresourceFilter. This class will make it easier | 21 // Wrapper around a WebDocumentSubresourceFilter. This class will make it easier |
| 22 // to extend the subresource filter with optimizations only possible using blink | 22 // to extend the subresource filter with optimizations only possible using blink |
| 23 // types (e.g. a caching layer using StringImpl). | 23 // types (e.g. a caching layer using StringImpl). |
| 24 class CORE_EXPORT SubresourceFilter final | 24 class CORE_EXPORT SubresourceFilter final |
| 25 : public GarbageCollectedFinalized<SubresourceFilter> { | 25 : public GarbageCollectedFinalized<SubresourceFilter> { |
| 26 public: | 26 public: |
| 27 static SubresourceFilter* create( | 27 static SubresourceFilter* create( |
| 28 DocumentLoader*, | 28 DocumentLoader*, |
| 29 std::unique_ptr<WebDocumentSubresourceFilter>); | 29 std::unique_ptr<WebDocumentSubresourceFilter>); |
| 30 ~SubresourceFilter(); | 30 ~SubresourceFilter(); |
| 31 | 31 |
| 32 bool allowLoad(const KURL& resourceUrl, | 32 bool allowLoad(const KURL& resourceUrl, |
| 33 WebURLRequest::RequestContext, | 33 WebURLRequest::RequestContext, |
| 34 SecurityViolationReportingPolicy); | 34 SecurityViolationReportingPolicy); |
| 35 bool allowWebSocketConnection(const KURL& resourceUrl); |
| 35 | 36 |
| 36 DEFINE_INLINE_TRACE() { visitor->trace(m_documentLoader); } | 37 DEFINE_INLINE_TRACE() { visitor->trace(m_documentLoader); } |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 SubresourceFilter(DocumentLoader*, | 40 SubresourceFilter(DocumentLoader*, |
| 40 std::unique_ptr<WebDocumentSubresourceFilter>); | 41 std::unique_ptr<WebDocumentSubresourceFilter>); |
| 41 | 42 |
| 43 void reportLoad(WebDocumentSubresourceFilter::LoadPolicy); |
| 44 |
| 42 Member<DocumentLoader> m_documentLoader; | 45 Member<DocumentLoader> m_documentLoader; |
| 43 std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter; | 46 std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter; |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 } // namespace blink | 49 } // namespace blink |
| 47 | 50 |
| 48 #endif // SubresourceFilter_h | 51 #endif // SubresourceFilter_h |
| OLD | NEW |