| Index: content/common/content_security_policy/csp_source.h
|
| diff --git a/content/common/content_security_policy/csp_source.h b/content/common/content_security_policy/csp_source.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..62670ed77f89d43a75be9f0c28128643887bb888
|
| --- /dev/null
|
| +++ b/content/common/content_security_policy/csp_source.h
|
| @@ -0,0 +1,66 @@
|
| +// 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_H_
|
| +#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "content/common/content_export.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace content {
|
| +
|
| +class CSPContext;
|
| +
|
| +// A CSPSource represents an expression that matches a set of urls.
|
| +// Examples of CSPSource:
|
| +// - domain.example.com
|
| +// - *.example.com
|
| +// - https://cdn.com
|
| +// - data:
|
| +// - 'none'
|
| +// - 'self'
|
| +// - *
|
| +struct CONTENT_EXPORT CSPSource {
|
| + CSPSource();
|
| + CSPSource(const std::string& scheme,
|
| + const std::string& host,
|
| + bool is_host_wildcard,
|
| + int port,
|
| + bool is_port_wildcard,
|
| + const std::string& path);
|
| + CSPSource(const CSPSource& source);
|
| + ~CSPSource();
|
| +
|
| + // Scheme.
|
| + std::string scheme;
|
| +
|
| + // Host.
|
| + std::string host;
|
| + bool is_host_wildcard;
|
| +
|
| + // port.
|
| + int port;
|
| + bool is_port_wildcard;
|
| +
|
| + // Path.
|
| + std::string path;
|
| +
|
| + std::string ToString() const;
|
| +
|
| + bool IsSchemeOnly() const;
|
| + bool HasPort() const;
|
| + bool HasHost() const;
|
| + bool HasPath() const;
|
| +
|
| + // Returns true if the |source| matches the |url| for a given |context|.
|
| + static bool Allow(const CSPSource& source,
|
| + const GURL& url,
|
| + CSPContext* context,
|
| + bool is_redirect = false);
|
| +};
|
| +
|
| +} // namespace content
|
| +#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_
|
|
|