OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 break; | 57 break; |
58 } | 58 } |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 return matchesWhitelist && !matchesBlacklist; | 62 return matchesWhitelist && !matchesBlacklist; |
63 } | 63 } |
64 | 64 |
65 bool UserContentURLPattern::parse(const String& pattern) | 65 bool UserContentURLPattern::parse(const String& pattern) |
66 { | 66 { |
67 DEFINE_STATIC_LOCAL(const String, schemeSeparator, (ASCIILiteral("://"))); | 67 DEFINE_STATIC_LOCAL(const String, schemeSeparator, ("://")); |
68 | 68 |
69 size_t schemeEndPos = pattern.find(schemeSeparator); | 69 size_t schemeEndPos = pattern.find(schemeSeparator); |
70 if (schemeEndPos == notFound) | 70 if (schemeEndPos == notFound) |
71 return false; | 71 return false; |
72 | 72 |
73 m_scheme = pattern.left(schemeEndPos); | 73 m_scheme = pattern.left(schemeEndPos); |
74 | 74 |
75 unsigned hostStartPos = schemeEndPos + schemeSeparator.length(); | 75 unsigned hostStartPos = schemeEndPos + schemeSeparator.length(); |
76 if (hostStartPos >= pattern.length()) | 76 if (hostStartPos >= pattern.length()) |
77 return false; | 77 return false; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 225 } |
226 }; | 226 }; |
227 | 227 |
228 bool UserContentURLPattern::matchesPath(const KURL& test) const | 228 bool UserContentURLPattern::matchesPath(const KURL& test) const |
229 { | 229 { |
230 MatchTester match(m_path, test.path()); | 230 MatchTester match(m_path, test.path()); |
231 return match.test(); | 231 return match.test(); |
232 } | 232 } |
233 | 233 |
234 } // namespace WebCore | 234 } // namespace WebCore |
OLD | NEW |