OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 const KURL& blankURL() | 961 const KURL& blankURL() |
962 { | 962 { |
963 static KURL staticBlankURL(ParsedURLString, "about:blank"); | 963 static KURL staticBlankURL(ParsedURLString, "about:blank"); |
964 return staticBlankURL; | 964 return staticBlankURL; |
965 } | 965 } |
966 | 966 |
967 bool protocolIs(const String& url, const char* protocol) | 967 bool protocolIs(const String& url, const char* protocol) |
968 { | 968 { |
969 // Do the comparison without making a new string object. | 969 // Do the comparison without making a new string object. |
970 assertProtocolIsGood(protocol); | 970 assertProtocolIsGood(protocol); |
971 for (int i = 0; ; ++i) { | 971 |
972 if (!protocol[i]) | 972 // Check the scheme like GURL does. |
973 return url[i] == ':'; | 973 return url_util::FindAndCompareScheme(url.characters(), url.length(), |
974 if (toASCIILower(url[i]) != protocol[i]) | 974 protocol, NULL); |
975 return false; | |
976 } | |
977 } | 975 } |
978 | 976 |
979 inline bool KURL::protocolIs(const String& string, const char* protocol) | 977 inline bool KURL::protocolIs(const String& string, const char* protocol) |
980 { | 978 { |
981 return WebCore::protocolIs(string, protocol); | 979 return WebCore::protocolIs(string, protocol); |
982 } | 980 } |
983 | 981 |
984 bool protocolHostAndPortAreEqual(const KURL& a, const KURL& b) | 982 bool protocolHostAndPortAreEqual(const KURL& a, const KURL& b) |
985 { | 983 { |
986 if (a.parsed().scheme.end() != b.parsed().scheme.end()) | 984 if (a.parsed().scheme.end() != b.parsed().scheme.end()) |
(...skipping 16 matching lines...) Expand all Loading... |
1003 | 1001 |
1004 if (a.port() != b.port()) | 1002 if (a.port() != b.port()) |
1005 return false; | 1003 return false; |
1006 | 1004 |
1007 return true; | 1005 return true; |
1008 } | 1006 } |
1009 | 1007 |
1010 } // namespace WebCore | 1008 } // namespace WebCore |
1011 | 1009 |
1012 #endif // USE(GOOGLEURL) | 1010 #endif // USE(GOOGLEURL) |
OLD | NEW |