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

Side by Side Diff: Source/platform/weborigin/OriginAccessEntry.h

Issue 1163583005: Add "registerable domain" support to OriginAccessEntry. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test. Created 5 years, 6 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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/platform/weborigin/OriginAccessEntry.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 23 matching lines...) Expand all
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class SecurityOrigin; 39 class SecurityOrigin;
40 40
41 class PLATFORM_EXPORT OriginAccessEntry { 41 class PLATFORM_EXPORT OriginAccessEntry {
42 public: 42 public:
43 enum SubdomainSetting { 43 enum SubdomainSetting {
44 // 'www.example.com' matches an OriginAccessEntry for 'example.com'
44 AllowSubdomains, 45 AllowSubdomains,
46
47 // 'www.example.com' matches an OriginAccessEntry for 'not-www.example.c om'
48 AllowRegisterableDomains,
49
50 // 'www.example.com' does not match an OriginAccessEntry for 'example.co m'
45 DisallowSubdomains 51 DisallowSubdomains
46 }; 52 };
47 53
48 enum MatchResult { 54 enum MatchResult {
49 MatchesOrigin, 55 MatchesOrigin,
50 MatchesOriginButIsPublicSuffix, 56 MatchesOriginButIsPublicSuffix,
51 DoesNotMatchOrigin 57 DoesNotMatchOrigin
52 }; 58 };
53 59
54 // If host is empty string and SubdomainSetting is AllowSubdomains, the entr y will match all domains in the specified protocol. 60 // If host is empty string and SubdomainSetting is not DisallowSubdomains, t he entry will match all domains in the specified protocol.
55 // IPv6 addresses must include brackets (e.g. '[2001:db8:85a3::8a2e:370:7334 ]', not '2001:db8:85a3::8a2e:370:7334'). 61 // IPv6 addresses must include brackets (e.g. '[2001:db8:85a3::8a2e:370:7334 ]', not '2001:db8:85a3::8a2e:370:7334').
56 OriginAccessEntry(const String& protocol, const String& host, SubdomainSetti ng); 62 OriginAccessEntry(const String& protocol, const String& host, SubdomainSetti ng);
57 MatchResult matchesOrigin(const SecurityOrigin&) const; 63 MatchResult matchesOrigin(const SecurityOrigin&) const;
58 64
59 const String& protocol() const { return m_protocol; } 65 const String& protocol() const { return m_protocol; }
60 const String& host() const { return m_host; } 66 const String& host() const { return m_host; }
61 SubdomainSetting subdomainSettings() const { return m_subdomainSettings; } 67 SubdomainSetting subdomainSettings() const { return m_subdomainSettings; }
62 bool hostIsIPAddress() const { return m_hostIsIPAddress; } 68 bool hostIsIPAddress() const { return m_hostIsIPAddress; }
69 const String& registerable() const { return m_registerableDomain; }
63 70
64 private: 71 private:
65 String m_protocol; 72 String m_protocol;
66 String m_host; 73 String m_host;
74 String m_registerableDomain;
67 SubdomainSetting m_subdomainSettings; 75 SubdomainSetting m_subdomainSettings;
68 bool m_hostIsIPAddress; 76 bool m_hostIsIPAddress;
69 bool m_hostIsPublicSuffix; 77 bool m_hostIsPublicSuffix;
70 }; 78 };
71 79
72 PLATFORM_EXPORT inline bool operator==(const OriginAccessEntry& a, const OriginA ccessEntry& b) 80 PLATFORM_EXPORT inline bool operator==(const OriginAccessEntry& a, const OriginA ccessEntry& b)
73 { 81 {
74 return equalIgnoringCase(a.protocol(), b.protocol()) 82 return equalIgnoringCase(a.protocol(), b.protocol())
75 && equalIgnoringCase(a.host(), b.host()) 83 && equalIgnoringCase(a.host(), b.host())
76 && a.subdomainSettings() == b.subdomainSettings(); 84 && a.subdomainSettings() == b.subdomainSettings();
77 } 85 }
78 86
79 PLATFORM_EXPORT inline bool operator!=(const OriginAccessEntry& a, const OriginA ccessEntry& b) 87 PLATFORM_EXPORT inline bool operator!=(const OriginAccessEntry& a, const OriginA ccessEntry& b)
80 { 88 {
81 return !(a == b); 89 return !(a == b);
82 } 90 }
83 91
84 } // namespace blink 92 } // namespace blink
85 93
86 #endif // OriginAccessEntry_h 94 #endif // OriginAccessEntry_h
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/platform/weborigin/OriginAccessEntry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698