| 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 "wtf/text/WTFString.h" | 8 #include "wtf/text/WTFString.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class ContentSecurityPolicy; | 12 class ContentSecurityPolicy; |
| 13 class KURL; | 13 class KURL; |
| 14 | 14 |
| 15 class CSPSource { | 15 class CSPSource { |
| 16 public: | 16 public: |
| 17 CSPSource(ContentSecurityPolicy*, const String& scheme, const String& host,
int port, const String& path, bool hostHasWildcard, bool portHasWildcard); | 17 enum WildcardDisposition { |
| 18 HasWildcard, |
| 19 NoWildcard |
| 20 }; |
| 21 |
| 22 CSPSource(ContentSecurityPolicy*, const String& scheme, const String& host,
int port, const String& path, WildcardDisposition hostWildcard, WildcardDisposit
ion portWildcard); |
| 18 bool matches(const KURL&) const; | 23 bool matches(const KURL&) const; |
| 19 | 24 |
| 20 private: | 25 private: |
| 21 bool schemeMatches(const KURL&) const; | 26 bool schemeMatches(const KURL&) const; |
| 22 bool hostMatches(const KURL&) const; | 27 bool hostMatches(const KURL&) const; |
| 23 bool pathMatches(const KURL&) const; | 28 bool pathMatches(const KURL&) const; |
| 24 bool portMatches(const KURL&) const; | 29 bool portMatches(const KURL&) const; |
| 25 bool isSchemeOnly() const; | 30 bool isSchemeOnly() const; |
| 26 | 31 |
| 27 ContentSecurityPolicy* m_policy; | 32 ContentSecurityPolicy* m_policy; |
| 28 String m_scheme; | 33 String m_scheme; |
| 29 String m_host; | 34 String m_host; |
| 30 int m_port; | 35 int m_port; |
| 31 String m_path; | 36 String m_path; |
| 32 | 37 |
| 33 bool m_hostHasWildcard; | 38 WildcardDisposition m_hostWildcard; |
| 34 bool m_portHasWildcard; | 39 WildcardDisposition m_portWildcard; |
| 35 }; | 40 }; |
| 36 | 41 |
| 37 } // namespace | 42 } // namespace |
| 38 | 43 |
| 39 #endif | 44 #endif |
| OLD | NEW |