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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/OriginAccessEntry.cpp

Issue 1661573002: Add 'OriginAccessEntry::matchDomain'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 4 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
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (dot == kNotFound) 102 if (dot == kNotFound)
103 m_registerableDomain = host; 103 m_registerableDomain = host;
104 else 104 else
105 m_registerableDomain = host.substring(dot + 1); 105 m_registerableDomain = host.substring(dot + 1);
106 } 106 }
107 } 107 }
108 } 108 }
109 109
110 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr igin& origin) const 110 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr igin& origin) const
111 { 111 {
112 ASSERT(origin.host() == origin.host().lower());
113 ASSERT(origin.protocol() == origin.protocol().lower()); 112 ASSERT(origin.protocol() == origin.protocol().lower());
114 113
115 if (m_protocol != origin.protocol()) 114 if (m_protocol != origin.protocol())
116 return DoesNotMatchOrigin; 115 return DoesNotMatchOrigin;
117 116
117 return matchesDomain(origin);
118 }
119
120 OriginAccessEntry::MatchResult OriginAccessEntry::matchesDomain(const SecurityOr igin& origin) const
121 {
122 ASSERT(origin.host() == origin.host().lower());
118 // Special case: Include subdomains and empty host means "all hosts, includi ng ip addresses". 123 // Special case: Include subdomains and empty host means "all hosts, includi ng ip addresses".
119 if (m_subdomainSettings != DisallowSubdomains && m_host.isEmpty()) 124 if (m_subdomainSettings != DisallowSubdomains && m_host.isEmpty())
120 return MatchesOrigin; 125 return MatchesOrigin;
121 126
122 // Exact match. 127 // Exact match.
123 if (m_host == origin.host()) 128 if (m_host == origin.host())
124 return MatchesOrigin; 129 return MatchesOrigin;
125 130
126 // Don't try to do subdomain matching on IP addresses. 131 // Don't try to do subdomain matching on IP addresses.
127 if (m_hostIsIPAddress) 132 if (m_hostIsIPAddress)
(...skipping 20 matching lines...) Expand all
148 break; 153 break;
149 }; 154 };
150 155
151 if (m_hostIsPublicSuffix) 156 if (m_hostIsPublicSuffix)
152 return MatchesOriginButIsPublicSuffix; 157 return MatchesOriginButIsPublicSuffix;
153 158
154 return MatchesOrigin; 159 return MatchesOrigin;
155 } 160 }
156 161
157 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698