diff options
author | Steve Block <steveblock@google.com> | 2010-09-29 17:32:26 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-29 17:35:08 +0100 |
commit | 68513a70bcd92384395513322f1b801e7bf9c729 (patch) | |
tree | 161b50f75a5921d61731bb25e730005994fcec85 /WebCore/fileapi/BlobURL.cpp | |
parent | fd5c6425ce58eb75211be7718d5dee960842a37e (diff) | |
download | external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.zip external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.gz external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.bz2 |
Merge WebKit at r67908: Initial merge by Git
Change-Id: I43a553e7b3299b28cb6ee8aa035ed70fe342b972
Diffstat (limited to 'WebCore/fileapi/BlobURL.cpp')
-rw-r--r-- | WebCore/fileapi/BlobURL.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/WebCore/fileapi/BlobURL.cpp b/WebCore/fileapi/BlobURL.cpp index c5571a7..47ebe8d 100644 --- a/WebCore/fileapi/BlobURL.cpp +++ b/WebCore/fileapi/BlobURL.cpp @@ -34,28 +34,27 @@ #include "KURL.h" #include "PlatformString.h" -#include "ScriptExecutionContext.h" #include "SecurityOrigin.h" #include "UUID.h" namespace WebCore { -KURL BlobURL::createURL(ScriptExecutionContext* scriptExecutionContext) +const char BlobURL::kBlobProtocol[] = "blob"; + +KURL BlobURL::createPublicURL(SecurityOrigin* securityOrigin) { - // Create the blob URL in the following format: - // blob:%escaped_origin%/%UUID% - // The origin of the host page is encoded in the URL value to allow easy lookup of the origin when the security check needs - // to be performed. - String urlString = "blob:"; - urlString += encodeWithURLEscapeSequences(scriptExecutionContext->securityOrigin()->toString()); - urlString += "/"; - urlString += createCanonicalUUIDString(); - return KURL(ParsedURLString, urlString); + ASSERT(securityOrigin); + return createBlobURL(securityOrigin->toString()); +} + +KURL BlobURL::createInternalURL() +{ + return createBlobURL("blobinternal://"); } KURL BlobURL::getOrigin(const KURL& url) { - ASSERT(url.protocolIs("blob")); + ASSERT(url.protocolIs(kBlobProtocol)); unsigned startIndex = url.pathStart(); unsigned afterEndIndex = url.pathAfterLastSlash(); @@ -65,10 +64,20 @@ KURL BlobURL::getOrigin(const KURL& url) String BlobURL::getIdentifier(const KURL& url) { - ASSERT(url.protocolIs("blob")); + ASSERT(url.protocolIs(kBlobProtocol)); unsigned startIndex = url.pathAfterLastSlash(); return url.string().substring(startIndex); } +KURL BlobURL::createBlobURL(const String& originString) +{ + String urlString = kBlobProtocol; + urlString += ":"; + urlString += encodeWithURLEscapeSequences(originString); + urlString += "/"; + urlString += createCanonicalUUIDString(); + return KURL(ParsedURLString, urlString); +} + } // namespace WebCore |