OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_ |
| 6 #define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "content/common/content_security_policy/csp_source.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class CSPContext; |
| 16 |
| 17 struct CONTENT_EXPORT CSPSourceList { |
| 18 CSPSourceList(); |
| 19 CSPSourceList(bool allow_self, |
| 20 bool allow_star, |
| 21 std::vector<CSPSource> source_list); |
| 22 CSPSourceList(const CSPSourceList&); |
| 23 ~CSPSourceList(); |
| 24 |
| 25 // Wildcard hosts and 'self' aren't stored in source_list, but as attributes |
| 26 // on the source list itself. |
| 27 bool allow_self; |
| 28 bool allow_star; |
| 29 std::vector<CSPSource> sources; |
| 30 |
| 31 std::string ToString() const; |
| 32 |
| 33 bool IsNone() const; |
| 34 |
| 35 // Return true when at least one source in the |source_list| matches the |
| 36 // |url| for a given |context|. |
| 37 static bool Allow(const CSPSourceList& source_list, |
| 38 const GURL& url, |
| 39 CSPContext* context, |
| 40 bool is_redirect = false); |
| 41 }; |
| 42 |
| 43 } // namespace content |
| 44 #endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_ |
OLD | NEW |