Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(938)

Unified Diff: content/common/content_security_policy/csp_directive.h

Issue 2612793002: Implement ContentSecurityPolicy on the browser-side. (Closed)
Patch Set: Nit. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/content_security_policy/csp_directive.h
diff --git a/content/common/content_security_policy/csp_directive.h b/content/common/content_security_policy/csp_directive.h
new file mode 100644
index 0000000000000000000000000000000000000000..f09611933c5e25ee2c6e6f893e8c53e81f511d84
--- /dev/null
+++ b/content/common/content_security_policy/csp_directive.h
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_
+#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_
+
+#include <string>
+#include "content/common/content_export.h"
+#include "content/common/content_security_policy/csp_source_list.h"
+
+namespace content {
+
+// 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!
+// Examples of CSPDirective:
+// - "default-src img.cdn.com example.com"
+// - "frame-src 'self'"
+struct CONTENT_EXPORT CSPDirective {
+ enum Name {
+ DefaultSrc,
+ ChildSrc,
+ FrameSrc,
+ FormAction,
+
+ Unknown,
+ NameLast = Unknown,
+ };
+
+ static std::string NameToString(Name name);
+ static Name StringToName(const std::string& name);
+
+ CSPDirective();
+ CSPDirective(Name name, const CSPSourceList& source_list);
+ CSPDirective(const CSPDirective&);
+
+ Name name;
+ CSPSourceList source_list;
+
+ std::string ToString() const;
+};
+
+} // namespace content
+#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_

Powered by Google App Engine
This is Rietveld 408576698