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 17 matching lines...) Expand all Loading... |
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 | 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 | 36 // algorithm at https://w3c.github.io/webappsec-csp/embedded/#subsume-policy |
37 bool subsumes(CSPSource*); | 37 bool subsumes(CSPSource*); |
| 38 // Retrieve the most restrictive information from the two CSPSources if |
| 39 // isSimilar is true for the two. Otherwise, return nullptr. |
| 40 CSPSource* intersect(CSPSource*); |
38 | 41 |
39 DECLARE_TRACE(); | 42 DECLARE_TRACE(); |
40 | 43 |
41 private: | 44 private: |
| 45 FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar); |
| 46 FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectCSPSources); |
| 47 |
42 bool schemeMatches(const String&) const; | 48 bool schemeMatches(const String&) const; |
43 bool hostMatches(const String&) const; | 49 bool hostMatches(const String&) const; |
44 bool pathMatches(const String&) const; | 50 bool pathMatches(const String&) const; |
45 // Protocol is necessary to determine default port if it is zero. | 51 // Protocol is necessary to determine default port if it is zero. |
46 bool portMatches(int port, const String& protocol) const; | 52 bool portMatches(int port, const String& protocol) const; |
47 bool isSchemeOnly() const; | 53 bool isSchemeOnly() const; |
| 54 bool isSimilar(CSPSource* other); |
48 | 55 |
49 Member<ContentSecurityPolicy> m_policy; | 56 Member<ContentSecurityPolicy> m_policy; |
50 String m_scheme; | 57 String m_scheme; |
51 String m_host; | 58 String m_host; |
52 int m_port; | 59 int m_port; |
53 String m_path; | 60 String m_path; |
54 | 61 |
55 WildcardDisposition m_hostWildcard; | 62 WildcardDisposition m_hostWildcard; |
56 WildcardDisposition m_portWildcard; | 63 WildcardDisposition m_portWildcard; |
57 }; | 64 }; |
58 | 65 |
59 } // namespace blink | 66 } // namespace blink |
60 | 67 |
61 #endif | 68 #endif |
OLD | NEW |