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_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 struct CONTENT_EXPORT CSPSource { | |
|
Mike West
2017/02/13 14:10:51
If your struct has methods and private members, it
arthursonzogni
2017/02/14 17:07:03
Yes, but I really want this struct to be a struct
Mike West
2017/02/15 16:18:17
I'll defer to //content/common OWNERS, I suppose,
| |
| 18 CSPSource(); | |
| 19 CSPSource(const std::string& scheme, | |
| 20 const std::string& host, | |
| 21 bool is_host_wildcard, | |
| 22 int port, | |
| 23 bool is_port_wildcard, | |
| 24 const std::string& path); | |
| 25 CSPSource(const CSPSource& source); | |
| 26 ~CSPSource(); | |
| 27 | |
| 28 // Scheme. | |
| 29 std::string scheme; | |
| 30 | |
| 31 // Host. | |
| 32 std::string host; | |
| 33 bool is_host_wildcard; | |
| 34 | |
| 35 // port. | |
| 36 int port; | |
| 37 bool is_port_wildcard; | |
| 38 | |
| 39 // Path. | |
| 40 std::string path; | |
| 41 | |
| 42 bool Allow(CSPContext* context, | |
| 43 const GURL& url, | |
| 44 bool is_redirect = false) const; | |
| 45 | |
| 46 std::string ToString() const; | |
| 47 | |
| 48 private: | |
| 49 bool IsSchemeOnly() const; | |
| 50 bool HasPort() const; | |
| 51 bool HasHost() const; | |
| 52 bool HasPath() const; | |
| 53 | |
| 54 bool AllowScheme(const GURL& url, CSPContext* context) const; | |
| 55 bool AllowHost(const GURL& url) const; | |
| 56 bool AllowPort(const GURL& url) const; | |
| 57 bool AllowPath(const GURL& url, bool is_redirect) const; | |
| 58 }; | |
| 59 | |
| 60 } // namespace content | |
| 61 #endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_ | |
| OLD | NEW |