Chromium Code Reviews| 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_DIRECTIVE_ | |
| 6 #define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include "content/common/content_export.h" | |
| 10 #include "content/common/content_security_policy/csp_source_list.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 // A CSPDirective is a set of allowed sources for a given usage. | |
|
Mike West
2017/02/15 16:18:18
How about something like:
"""
CSPDirective contai
arthursonzogni
2017/02/16 13:30:25
I really like, thanks!
| |
| 15 // Examples of CSPDirective: | |
| 16 // - "default-src img.cdn.com example.com" | |
| 17 // - "frame-src 'self'" | |
| 18 struct CONTENT_EXPORT CSPDirective { | |
| 19 enum Name { | |
| 20 DefaultSrc, | |
| 21 ChildSrc, | |
| 22 FrameSrc, | |
| 23 FormAction, | |
| 24 | |
| 25 Unknown, | |
| 26 NameLast = Unknown, | |
| 27 }; | |
| 28 | |
| 29 static std::string NameToString(Name name); | |
| 30 static Name StringToName(const std::string& name); | |
| 31 | |
| 32 CSPDirective(); | |
| 33 CSPDirective(Name name, const CSPSourceList& source_list); | |
| 34 CSPDirective(const CSPDirective&); | |
| 35 | |
| 36 Name name; | |
| 37 CSPSourceList source_list; | |
| 38 | |
| 39 std::string ToString() const; | |
| 40 }; | |
| 41 | |
| 42 } // namespace content | |
| 43 #endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_ | |
| OLD | NEW |