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

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

Issue 2612793002: Implement ContentSecurityPolicy on the browser-side. (Closed)
Patch Set: Rename SchemeShouldBypass => SchemeShouldBypassCSP. 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_source_list.h
diff --git a/content/common/content_security_policy/csp_source_list.h b/content/common/content_security_policy/csp_source_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..083e619aab551b96e6828d4b202e5eec5f720fe6
--- /dev/null
+++ b/content/common/content_security_policy/csp_source_list.h
@@ -0,0 +1,45 @@
+// 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_SOURCE_LIST_H_
+#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_
+
+#include <vector>
+
+#include "content/common/content_security_policy/csp_source.h"
+#include "url/gurl.h"
+
+namespace content {
+
+class CSPContext;
+
+struct CONTENT_EXPORT CSPSourceList {
+ CSPSourceList();
+ CSPSourceList(bool allow_self,
+ bool allow_star,
+ std::vector<CSPSource> source_list);
+ CSPSourceList(const CSPSourceList&);
+ ~CSPSourceList();
+
+ // Wildcard hosts and 'self' aren't stored in source_list, but as attributes
+ // on the source list itself.
+ bool allow_self;
+ bool allow_star;
+ std::vector<CSPSource> source_list;
+
+ bool Allow(CSPContext* context,
+ const GURL& url,
+ bool is_redirect = false) const;
+
+ std::string ToString() const;
+
+ private:
+ bool AllowFromSources(CSPContext* context,
+ const GURL& url,
+ bool is_redirect) const;
+ bool IsNone() const;
+};
+
+} // namespace content
+#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698