OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 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 22 matching lines...) Expand all Loading... |
33 #include "platform/weborigin/KURL.h" | 33 #include "platform/weborigin/KURL.h" |
34 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
35 #include "url/url_util.h" | 35 #include "url/url_util.h" |
36 #include "wtf/text/StringUTF8Adaptor.h" | 36 #include "wtf/text/StringUTF8Adaptor.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 static bool resolveRelative(const KURL& base, | 40 static bool resolveRelative(const KURL& base, |
41 const String& relative, | 41 const String& relative, |
42 url::RawCanonOutput<2048>* buffer) { | 42 url::RawCanonOutput<2048>* buffer) { |
43 // We use these low-level GURL functions to avoid converting back and forth fr
om UTF-8 unnecessarily. | 43 // We use these low-level GURL functions to avoid converting back and forth |
| 44 // from UTF-8 unnecessarily. |
44 url::Parsed parsed; | 45 url::Parsed parsed; |
45 StringUTF8Adaptor baseUTF8(base.getString()); | 46 StringUTF8Adaptor baseUTF8(base.getString()); |
46 if (relative.is8Bit()) { | 47 if (relative.is8Bit()) { |
47 StringUTF8Adaptor relativeUTF8(relative); | 48 StringUTF8Adaptor relativeUTF8(relative); |
48 return url::ResolveRelative(baseUTF8.data(), baseUTF8.length(), | 49 return url::ResolveRelative(baseUTF8.data(), baseUTF8.length(), |
49 base.parsed(), relativeUTF8.data(), | 50 base.parsed(), relativeUTF8.data(), |
50 relativeUTF8.length(), 0, buffer, &parsed); | 51 relativeUTF8.length(), 0, buffer, &parsed); |
51 } | 52 } |
52 return url::ResolveRelative(baseUTF8.data(), baseUTF8.length(), base.parsed(), | 53 return url::ResolveRelative(baseUTF8.data(), baseUTF8.length(), base.parsed(), |
53 relative.characters16(), relative.length(), 0, | 54 relative.characters16(), relative.length(), 0, |
54 buffer, &parsed); | 55 buffer, &parsed); |
55 } | 56 } |
56 | 57 |
57 LinkHash visitedLinkHash(const KURL& base, const AtomicString& relative) { | 58 LinkHash visitedLinkHash(const KURL& base, const AtomicString& relative) { |
58 if (relative.isNull()) | 59 if (relative.isNull()) |
59 return 0; | 60 return 0; |
60 url::RawCanonOutput<2048> buffer; | 61 url::RawCanonOutput<2048> buffer; |
61 if (!resolveRelative(base, relative.getString(), &buffer)) | 62 if (!resolveRelative(base, relative.getString(), &buffer)) |
62 return 0; | 63 return 0; |
63 return Platform::current()->visitedLinkHash(buffer.data(), buffer.length()); | 64 return Platform::current()->visitedLinkHash(buffer.data(), buffer.length()); |
64 } | 65 } |
65 | 66 |
66 } // namespace blink | 67 } // namespace blink |
OLD | NEW |