Home | History | Annotate | Download | only in csp
      1 // Copyright 2014 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 CSPSource_h
      6 #define CSPSource_h
      7 
      8 #include "wtf/text/WTFString.h"
      9 
     10 namespace blink {
     11 
     12 class ContentSecurityPolicy;
     13 class KURL;
     14 
     15 class CSPSource {
     16 public:
     17     enum WildcardDisposition {
     18         HasWildcard,
     19         NoWildcard
     20     };
     21 
     22     CSPSource(ContentSecurityPolicy*, const String& scheme, const String& host, int port, const String& path, WildcardDisposition hostWildcard, WildcardDisposition portWildcard);
     23     bool matches(const KURL&) const;
     24 
     25 private:
     26     bool schemeMatches(const KURL&) const;
     27     bool hostMatches(const KURL&) const;
     28     bool pathMatches(const KURL&) const;
     29     bool portMatches(const KURL&) const;
     30     bool isSchemeOnly() const;
     31 
     32     ContentSecurityPolicy* m_policy;
     33     String m_scheme;
     34     String m_host;
     35     int m_port;
     36     String m_path;
     37 
     38     WildcardDisposition m_hostWildcard;
     39     WildcardDisposition m_portWildcard;
     40 };
     41 
     42 } // namespace
     43 
     44 #endif
     45