| 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 "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
| 11 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class ContentSecurityPolicy; | 16 class ContentSecurityPolicy; |
| 16 class KURL; | 17 class KURL; |
| 17 | 18 |
| 18 class CORE_EXPORT CSPSource { | 19 class CORE_EXPORT CSPSource { |
| 19 USING_FAST_MALLOC(CSPSource); | 20 USING_FAST_MALLOC(CSPSource); |
| 20 public: | 21 public: |
| 21 enum WildcardDisposition { | 22 enum WildcardDisposition { |
| 22 HasWildcard, | 23 HasWildcard, |
| 23 NoWildcard | 24 NoWildcard |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 CSPSource(ContentSecurityPolicy*, const String& scheme, const String& host,
int port, const String& path, WildcardDisposition hostWildcard, WildcardDisposit
ion portWildcard); | 27 CSPSource(ContentSecurityPolicy*, const String& scheme, const String& host,
int port, const String& path, WildcardDisposition hostWildcard, WildcardDisposit
ion portWildcard); |
| 27 bool matches(const KURL&, ContentSecurityPolicy::RedirectStatus = ContentSec
urityPolicy::DidNotRedirect) const; | 28 bool matches(const KURL&, ContentSecurityPolicy::RedirectStatus = ContentSec
urityPolicy::DidNotRedirect) const; |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 bool schemeMatches(const KURL&) const; | 31 bool schemeMatches(const KURL&) const; |
| 31 bool hostMatches(const KURL&) const; | 32 bool hostMatches(const KURL&) const; |
| 32 bool pathMatches(const KURL&) const; | 33 bool pathMatches(const KURL&) const; |
| 33 bool portMatches(const KURL&) const; | 34 bool portMatches(const KURL&) const; |
| 34 bool isSchemeOnly() const; | 35 bool isSchemeOnly() const; |
| 35 | 36 |
| 36 ContentSecurityPolicy* m_policy; | 37 // TODO(Oilpan): consider moving ContentSecurityPolicy auxilliary objects to
the heap. |
| 38 RawPtrWillBeUntracedMember<ContentSecurityPolicy> m_policy; |
| 37 String m_scheme; | 39 String m_scheme; |
| 38 String m_host; | 40 String m_host; |
| 39 int m_port; | 41 int m_port; |
| 40 String m_path; | 42 String m_path; |
| 41 | 43 |
| 42 WildcardDisposition m_hostWildcard; | 44 WildcardDisposition m_hostWildcard; |
| 43 WildcardDisposition m_portWildcard; | 45 WildcardDisposition m_portWildcard; |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace | 48 } // namespace |
| 47 | 49 |
| 48 #endif | 50 #endif |
| OLD | NEW |