| 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 #ifndef CSPSource_h | 5 #ifndef CSPSource_h |
| 6 #define CSPSource_h | 6 #define CSPSource_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/frame/csp/ContentSecurityPolicy.h" | 9 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
| 12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class ContentSecurityPolicy; | 16 class ContentSecurityPolicy; |
| 17 class KURL; | 17 class KURL; |
| 18 | 18 |
| 19 class CORE_EXPORT CSPSource : public NoBaseWillBeGarbageCollectedFinalized<CSPSo
urce> { | 19 class CORE_EXPORT CSPSource : public GarbageCollectedFinalized<CSPSource> { |
| 20 USING_FAST_MALLOC_WILL_BE_REMOVED(CSPSource); | |
| 21 public: | 20 public: |
| 22 enum WildcardDisposition { | 21 enum WildcardDisposition { |
| 23 HasWildcard, | 22 HasWildcard, |
| 24 NoWildcard | 23 NoWildcard |
| 25 }; | 24 }; |
| 26 | 25 |
| 27 CSPSource(ContentSecurityPolicy*, const String& scheme, const String& host,
int port, const String& path, WildcardDisposition hostWildcard, WildcardDisposit
ion portWildcard); | 26 CSPSource(ContentSecurityPolicy*, const String& scheme, const String& host,
int port, const String& path, WildcardDisposition hostWildcard, WildcardDisposit
ion portWildcard); |
| 28 bool matches(const KURL&, ContentSecurityPolicy::RedirectStatus = ContentSec
urityPolicy::DidNotRedirect) const; | 27 bool matches(const KURL&, ContentSecurityPolicy::RedirectStatus = ContentSec
urityPolicy::DidNotRedirect) const; |
| 29 | 28 |
| 30 DECLARE_TRACE(); | 29 DECLARE_TRACE(); |
| 31 | 30 |
| 32 private: | 31 private: |
| 33 bool schemeMatches(const KURL&) const; | 32 bool schemeMatches(const KURL&) const; |
| 34 bool hostMatches(const KURL&) const; | 33 bool hostMatches(const KURL&) const; |
| 35 bool pathMatches(const KURL&) const; | 34 bool pathMatches(const KURL&) const; |
| 36 bool portMatches(const KURL&) const; | 35 bool portMatches(const KURL&) const; |
| 37 bool isSchemeOnly() const; | 36 bool isSchemeOnly() const; |
| 38 | 37 |
| 39 RawPtrWillBeMember<ContentSecurityPolicy> m_policy; | 38 Member<ContentSecurityPolicy> m_policy; |
| 40 String m_scheme; | 39 String m_scheme; |
| 41 String m_host; | 40 String m_host; |
| 42 int m_port; | 41 int m_port; |
| 43 String m_path; | 42 String m_path; |
| 44 | 43 |
| 45 WildcardDisposition m_hostWildcard; | 44 WildcardDisposition m_hostWildcard; |
| 46 WildcardDisposition m_portWildcard; | 45 WildcardDisposition m_portWildcard; |
| 47 }; | 46 }; |
| 48 | 47 |
| 49 } // namespace blink | 48 } // namespace blink |
| 50 | 49 |
| 51 #endif | 50 #endif |
| OLD | NEW |