| 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 23 matching lines...) Expand all Loading... |
| 34 #include "modules/filesystem/DOMFilePath.h" | 34 #include "modules/filesystem/DOMFilePath.h" |
| 35 #include "modules/filesystem/DirectoryEntry.h" | 35 #include "modules/filesystem/DirectoryEntry.h" |
| 36 #include "modules/filesystem/ErrorCallback.h" | 36 #include "modules/filesystem/ErrorCallback.h" |
| 37 #include "modules/filesystem/FileEntry.h" | 37 #include "modules/filesystem/FileEntry.h" |
| 38 #include "modules/filesystem/FileSystemCallbacks.h" | 38 #include "modules/filesystem/FileSystemCallbacks.h" |
| 39 #include "modules/filesystem/FileWriter.h" | 39 #include "modules/filesystem/FileWriter.h" |
| 40 #include "modules/filesystem/FileWriterBaseCallback.h" | 40 #include "modules/filesystem/FileWriterBaseCallback.h" |
| 41 #include "modules/filesystem/FileWriterCallback.h" | 41 #include "modules/filesystem/FileWriterCallback.h" |
| 42 #include "modules/filesystem/MetadataCallback.h" | 42 #include "modules/filesystem/MetadataCallback.h" |
| 43 #include "platform/FileMetadata.h" | 43 #include "platform/FileMetadata.h" |
| 44 #include "platform/weborigin/DatabaseIdentifier.h" | |
| 45 #include "platform/weborigin/SecurityOrigin.h" | 44 #include "platform/weborigin/SecurityOrigin.h" |
| 45 #include "public/platform/Platform.h" |
| 46 #include "public/platform/WebFileSystem.h" | 46 #include "public/platform/WebFileSystem.h" |
| 47 #include "public/platform/WebFileSystemCallbacks.h" | 47 #include "public/platform/WebFileSystemCallbacks.h" |
| 48 #include "public/platform/WebSecurityOrigin.h" |
| 48 #include "wtf/OwnPtr.h" | 49 #include "wtf/OwnPtr.h" |
| 49 #include "wtf/text/StringBuilder.h" | 50 #include "wtf/text/StringBuilder.h" |
| 50 #include "wtf/text/WTFString.h" | 51 #include "wtf/text/WTFString.h" |
| 51 | 52 |
| 52 namespace blink { | 53 namespace blink { |
| 53 | 54 |
| 54 // static | 55 // static |
| 55 DOMFileSystem* DOMFileSystem::create(ExecutionContext* context, const String& na
me, FileSystemType type, const KURL& rootURL) | 56 DOMFileSystem* DOMFileSystem::create(ExecutionContext* context, const String& na
me, FileSystemType type, const KURL& rootURL) |
| 56 { | 57 { |
| 57 DOMFileSystem* fileSystem(new DOMFileSystem(context, name, type, rootURL)); | 58 DOMFileSystem* fileSystem(new DOMFileSystem(context, name, type, rootURL)); |
| 58 fileSystem->suspendIfNeeded(); | 59 fileSystem->suspendIfNeeded(); |
| 59 return fileSystem; | 60 return fileSystem; |
| 60 } | 61 } |
| 61 | 62 |
| 62 DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(ExecutionContext* context
, const String& filesystemId) | 63 DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(ExecutionContext* context
, const String& filesystemId) |
| 63 { | 64 { |
| 64 if (filesystemId.isEmpty()) | 65 if (filesystemId.isEmpty()) |
| 65 return 0; | 66 return 0; |
| 66 | 67 |
| 67 StringBuilder filesystemName; | 68 StringBuilder filesystemName; |
| 68 filesystemName.append(createDatabaseIdentifierFromSecurityOrigin(context->ge
tSecurityOrigin())); | 69 filesystemName.append(Platform::current()->fileSystemCreateOriginIdentifier(
WebSecurityOrigin(context->getSecurityOrigin()))); |
| 69 filesystemName.appendLiteral(":Isolated_"); | 70 filesystemName.appendLiteral(":Isolated_"); |
| 70 filesystemName.append(filesystemId); | 71 filesystemName.append(filesystemId); |
| 71 | 72 |
| 72 // The rootURL created here is going to be attached to each filesystem reque
st and | 73 // The rootURL created here is going to be attached to each filesystem reque
st and |
| 73 // is to be validated each time the request is being handled. | 74 // is to be validated each time the request is being handled. |
| 74 StringBuilder rootURL; | 75 StringBuilder rootURL; |
| 75 rootURL.appendLiteral("filesystem:"); | 76 rootURL.appendLiteral("filesystem:"); |
| 76 rootURL.append(context->getSecurityOrigin()->toString()); | 77 rootURL.append(context->getSecurityOrigin()->toString()); |
| 77 rootURL.append('/'); | 78 rootURL.append('/'); |
| 78 rootURL.append(isolatedPathPrefix); | 79 rootURL.append(isolatedPathPrefix); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 176 } |
| 176 | 177 |
| 177 DEFINE_TRACE(DOMFileSystem) | 178 DEFINE_TRACE(DOMFileSystem) |
| 178 { | 179 { |
| 179 DOMFileSystemBase::trace(visitor); | 180 DOMFileSystemBase::trace(visitor); |
| 180 ActiveDOMObject::trace(visitor); | 181 ActiveDOMObject::trace(visitor); |
| 181 visitor->trace(m_rootEntry); | 182 visitor->trace(m_rootEntry); |
| 182 } | 183 } |
| 183 | 184 |
| 184 } // namespace blink | 185 } // namespace blink |
| OLD | NEW |