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