OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 , m_ipAddressSettings(ipAddressSetting) | 44 , m_ipAddressSettings(ipAddressSetting) |
45 , m_hostIsPublicSuffix(false) | 45 , m_hostIsPublicSuffix(false) |
46 { | 46 { |
47 ASSERT(subdomainSetting == AllowSubdomains || subdomainSetting == DisallowSu
bdomains); | 47 ASSERT(subdomainSetting == AllowSubdomains || subdomainSetting == DisallowSu
bdomains); |
48 | 48 |
49 // Assume that any host that ends with a digit is trying to be an IP address
. | 49 // Assume that any host that ends with a digit is trying to be an IP address
. |
50 m_hostIsIPAddress = !m_host.isEmpty() && isASCIIDigit(m_host[m_host.length()
- 1]); | 50 m_hostIsIPAddress = !m_host.isEmpty() && isASCIIDigit(m_host[m_host.length()
- 1]); |
51 | 51 |
52 // Look for top-level domains, either with or without an additional dot. | 52 // Look for top-level domains, either with or without an additional dot. |
53 if (!m_hostIsIPAddress) { | 53 if (!m_hostIsIPAddress) { |
54 blink::WebPublicSuffixList* suffixList = blink::Platform::current()->pub
licSuffixList(); | 54 WebPublicSuffixList* suffixList = Platform::current()->publicSuffixList(
); |
55 if (suffixList && m_host.length() <= suffixList->getPublicSuffixLength(m
_host) + 1) | 55 if (suffixList && m_host.length() <= suffixList->getPublicSuffixLength(m
_host) + 1) |
56 m_hostIsPublicSuffix = true; | 56 m_hostIsPublicSuffix = true; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr
igin& origin) const | 60 OriginAccessEntry::MatchResult OriginAccessEntry::matchesOrigin(const SecurityOr
igin& origin) const |
61 { | 61 { |
62 ASSERT(origin.host() == origin.host().lower()); | 62 ASSERT(origin.host() == origin.host().lower()); |
63 ASSERT(origin.protocol() == origin.protocol().lower()); | 63 ASSERT(origin.protocol() == origin.protocol().lower()); |
64 | 64 |
(...skipping 20 matching lines...) Expand all Loading... |
85 if (origin.host().length() <= m_host.length() || origin.host()[origin.host()
.length() - m_host.length() - 1] != '.' || !origin.host().endsWith(m_host)) | 85 if (origin.host().length() <= m_host.length() || origin.host()[origin.host()
.length() - m_host.length() - 1] != '.' || !origin.host().endsWith(m_host)) |
86 return DoesNotMatchOrigin; | 86 return DoesNotMatchOrigin; |
87 | 87 |
88 if (m_hostIsPublicSuffix) | 88 if (m_hostIsPublicSuffix) |
89 return MatchesOriginButIsPublicSuffix; | 89 return MatchesOriginButIsPublicSuffix; |
90 | 90 |
91 return MatchesOrigin; | 91 return MatchesOrigin; |
92 } | 92 } |
93 | 93 |
94 } // namespace blink | 94 } // namespace blink |
OLD | NEW |