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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 const String& scheme, | 25 const String& scheme, |
26 const String& host, | 26 const String& host, |
27 int port, | 27 int port, |
28 const String& path, | 28 const String& path, |
29 WildcardDisposition hostWildcard, | 29 WildcardDisposition hostWildcard, |
30 WildcardDisposition portWildcard); | 30 WildcardDisposition portWildcard); |
31 bool matches(const KURL&, | 31 bool matches(const KURL&, |
32 ResourceRequest::RedirectStatus = | 32 ResourceRequest::RedirectStatus = |
33 ResourceRequest::RedirectStatus::NoRedirect) const; | 33 ResourceRequest::RedirectStatus::NoRedirect) const; |
34 | 34 |
| 35 // Returns true if this CSPSource subsumes the other, as defined by the |
| 36 // algorithm at https://w3c.github.io/webappsec-csp/embedded/#subsume-policy |
| 37 bool subsumes(CSPSource*); |
| 38 |
35 DECLARE_TRACE(); | 39 DECLARE_TRACE(); |
36 | 40 |
37 private: | 41 private: |
38 bool schemeMatches(const String&) const; | 42 bool schemeMatches(const String&) const; |
39 bool hostMatches(const String&) const; | 43 bool hostMatches(const String&) const; |
40 bool pathMatches(const String&) const; | 44 bool pathMatches(const String&) const; |
41 // Protocol is necessary to determine default port if it is zero. | 45 // Protocol is necessary to determine default port if it is zero. |
42 bool portMatches(int port, const String& protocol) const; | 46 bool portMatches(int port, const String& protocol) const; |
43 bool isSchemeOnly() const; | 47 bool isSchemeOnly() const; |
44 | 48 |
45 Member<ContentSecurityPolicy> m_policy; | 49 Member<ContentSecurityPolicy> m_policy; |
46 String m_scheme; | 50 String m_scheme; |
47 String m_host; | 51 String m_host; |
48 int m_port; | 52 int m_port; |
49 String m_path; | 53 String m_path; |
50 | 54 |
51 WildcardDisposition m_hostWildcard; | 55 WildcardDisposition m_hostWildcard; |
52 WildcardDisposition m_portWildcard; | 56 WildcardDisposition m_portWildcard; |
53 }; | 57 }; |
54 | 58 |
55 } // namespace blink | 59 } // namespace blink |
56 | 60 |
57 #endif | 61 #endif |
OLD | NEW |