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

Side by Side Diff: content/common/content_security_policy/csp_source.h

Issue 2612793002: Implement ContentSecurityPolicy on the browser-side. (Closed)
Patch Set: Add the TODO and bug ids that was forgotten. 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 unified diff | Download patch
OLDNEW
(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_H_
6 #define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_
7
8 #include <string>
9
10 #include "content/common/content_export.h"
11 #include "url/gurl.h"
12
13 namespace content {
14
15 class CSPContext;
16
17 // A CSPSource represents an expression that matches a set of urls.
18 // Examples of CSPSource:
19 // - domain.example.com
20 // - *.example.com
21 // - https://cdn.com
22 // - data:
23 // - 'none'
24 // - 'self'
25 // - *
26 struct CONTENT_EXPORT CSPSource {
27 CSPSource();
28 CSPSource(const std::string& scheme,
29 const std::string& host,
30 bool is_host_wildcard,
31 int port,
32 bool is_port_wildcard,
33 const std::string& path);
34 CSPSource(const CSPSource& source);
35 ~CSPSource();
36
37 // Scheme.
38 std::string scheme;
39
40 // Host.
41 std::string host;
42 bool is_host_wildcard;
43
44 // port.
45 int port;
46 bool is_port_wildcard;
47
48 // Path.
49 std::string path;
50
51 std::string ToString() const;
52
53 bool IsSchemeOnly() const;
54 bool HasPort() const;
55 bool HasHost() const;
56 bool HasPath() const;
57
58 // Returns true if the |source| matches the |url| for a given |context|.
59 static bool Allow(const CSPSource& source,
60 const GURL& url,
61 CSPContext* context,
62 bool is_redirect = false);
63 };
64
65 } // namespace content
66 #endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_
OLDNEW
« no previous file with comments | « content/common/content_security_policy/csp_directive.cc ('k') | content/common/content_security_policy/csp_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698