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 13 matching lines...) Expand all Loading... | |
24 CSPSource(ContentSecurityPolicy*, | 24 CSPSource(ContentSecurityPolicy*, |
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 bool isSubsumed(CSPSource*); | |
Mike West
2016/10/26 11:40:30
Nit: Please add a comment here, and probably point
| |
35 // Find the normalized CSPSource of the two. | |
Mike West
2016/10/26 11:40:30
1. What does "normalize" mean?
2. It would be grea
| |
36 CSPSource* getCommon(CSPSource*); | |
34 | 37 |
35 DECLARE_TRACE(); | 38 DECLARE_TRACE(); |
36 | 39 |
37 private: | 40 private: |
38 bool schemeMatches(const KURL&) const; | 41 bool schemeMatches(const KURL&) const; |
39 bool hostMatches(const KURL&) const; | 42 bool hostMatches(const KURL&) const; |
40 bool pathMatches(const KURL&) const; | 43 bool pathMatches(const KURL&) const; |
41 bool portMatches(const KURL&) const; | 44 bool portMatches(const KURL&) const; |
42 bool isSchemeOnly() const; | 45 bool isSchemeOnly() const; |
43 | 46 |
47 bool schemeMatches(const String&) const; | |
48 bool hostMatches(const String&) const; | |
49 bool pathMatches(const String&) const; | |
50 bool portMatches(int, const String&) const; | |
Mike West
2016/10/26 11:40:30
Would you mind pulling this refactoring out into a
| |
51 | |
52 bool isSimilar(CSPSource* other); | |
Mike West
2016/10/26 11:40:30
It's probably worth adding unit tests for this pie
| |
53 | |
44 Member<ContentSecurityPolicy> m_policy; | 54 Member<ContentSecurityPolicy> m_policy; |
45 String m_scheme; | 55 String m_scheme; |
46 String m_host; | 56 String m_host; |
47 int m_port; | 57 int m_port; |
48 String m_path; | 58 String m_path; |
49 | 59 |
50 WildcardDisposition m_hostWildcard; | 60 WildcardDisposition m_hostWildcard; |
51 WildcardDisposition m_portWildcard; | 61 WildcardDisposition m_portWildcard; |
52 }; | 62 }; |
53 | 63 |
54 } // namespace blink | 64 } // namespace blink |
55 | 65 |
56 #endif | 66 #endif |
OLD | NEW |