| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 29 matching lines...) Expand all Loading... |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 const char BlobURL::kBlobProtocol[] = "blob"; | 42 const char BlobURL::kBlobProtocol[] = "blob"; |
| 43 | 43 |
| 44 KURL BlobURL::createPublicURL(SecurityOrigin* securityOrigin) | 44 KURL BlobURL::createPublicURL(SecurityOrigin* securityOrigin) |
| 45 { | 45 { |
| 46 ASSERT(securityOrigin); | 46 ASSERT(securityOrigin); |
| 47 return createBlobURL(securityOrigin->toString()); | 47 return createBlobURL(securityOrigin->toString()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 KURL BlobURL::createInternalURL() | |
| 51 { | |
| 52 return createBlobURL("blobinternal://"); | |
| 53 } | |
| 54 | |
| 55 String BlobURL::getOrigin(const KURL& url) | 50 String BlobURL::getOrigin(const KURL& url) |
| 56 { | 51 { |
| 57 ASSERT(url.protocolIs(kBlobProtocol)); | 52 ASSERT(url.protocolIs(kBlobProtocol)); |
| 58 | 53 |
| 59 unsigned startIndex = url.pathStart(); | 54 unsigned startIndex = url.pathStart(); |
| 60 unsigned endIndex = url.pathAfterLastSlash(); | 55 unsigned endIndex = url.pathAfterLastSlash(); |
| 61 return url.string().substring(startIndex, endIndex - startIndex - 1); | 56 return url.string().substring(startIndex, endIndex - startIndex - 1); |
| 62 } | 57 } |
| 63 | 58 |
| 64 String BlobURL::getIdentifier(const KURL& url) | 59 KURL BlobURL::createInternalStreamURL() |
| 65 { | 60 { |
| 66 ASSERT(url.protocolIs(kBlobProtocol)); | 61 return createBlobURL("blobinternal://"); |
| 67 | |
| 68 unsigned startIndex = url.pathAfterLastSlash(); | |
| 69 return url.string().substring(startIndex); | |
| 70 } | 62 } |
| 71 | 63 |
| 72 KURL BlobURL::createBlobURL(const String& originString) | 64 KURL BlobURL::createBlobURL(const String& originString) |
| 73 { | 65 { |
| 74 ASSERT(!originString.isEmpty()); | 66 ASSERT(!originString.isEmpty()); |
| 75 String urlString = "blob:" + encodeWithURLEscapeSequences(originString) + '/
' + createCanonicalUUIDString(); | 67 String urlString = "blob:" + encodeWithURLEscapeSequences(originString) + '/
' + createCanonicalUUIDString(); |
| 76 return KURL::createIsolated(ParsedURLString, urlString); | 68 return KURL::createIsolated(ParsedURLString, urlString); |
| 77 } | 69 } |
| 78 | 70 |
| 79 } // namespace WebCore | 71 } // namespace WebCore |
| OLD | NEW |