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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 fileSystem->suspendIfNeeded(); | 58 fileSystem->suspendIfNeeded(); |
59 return fileSystem; | 59 return fileSystem; |
60 } | 60 } |
61 | 61 |
62 DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(ExecutionContext* context
, const String& filesystemId) | 62 DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(ExecutionContext* context
, const String& filesystemId) |
63 { | 63 { |
64 if (filesystemId.isEmpty()) | 64 if (filesystemId.isEmpty()) |
65 return 0; | 65 return 0; |
66 | 66 |
67 StringBuilder filesystemName; | 67 StringBuilder filesystemName; |
68 filesystemName.append(createDatabaseIdentifierFromSecurityOrigin(context->se
curityOrigin())); | 68 filesystemName.append(createDatabaseIdentifierFromSecurityOrigin(context->ge
tSecurityOrigin())); |
69 filesystemName.appendLiteral(":Isolated_"); | 69 filesystemName.appendLiteral(":Isolated_"); |
70 filesystemName.append(filesystemId); | 70 filesystemName.append(filesystemId); |
71 | 71 |
72 // The rootURL created here is going to be attached to each filesystem reque
st and | 72 // 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. | 73 // is to be validated each time the request is being handled. |
74 StringBuilder rootURL; | 74 StringBuilder rootURL; |
75 rootURL.appendLiteral("filesystem:"); | 75 rootURL.appendLiteral("filesystem:"); |
76 rootURL.append(context->securityOrigin()->toString()); | 76 rootURL.append(context->getSecurityOrigin()->toString()); |
77 rootURL.append('/'); | 77 rootURL.append('/'); |
78 rootURL.append(isolatedPathPrefix); | 78 rootURL.append(isolatedPathPrefix); |
79 rootURL.append('/'); | 79 rootURL.append('/'); |
80 rootURL.append(filesystemId); | 80 rootURL.append(filesystemId); |
81 rootURL.append('/'); | 81 rootURL.append('/'); |
82 | 82 |
83 return DOMFileSystem::create(context, filesystemName.toString(), FileSystemT
ypeIsolated, KURL(ParsedURLString, rootURL.toString())); | 83 return DOMFileSystem::create(context, filesystemName.toString(), FileSystemT
ypeIsolated, KURL(ParsedURLString, rootURL.toString())); |
84 } | 84 } |
85 | 85 |
86 DOMFileSystem::DOMFileSystem(ExecutionContext* context, const String& name, File
SystemType type, const KURL& rootURL) | 86 DOMFileSystem::DOMFileSystem(ExecutionContext* context, const String& name, File
SystemType type, const KURL& rootURL) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 void DOMFileSystem::createWriter(const FileEntry* fileEntry, FileWriterCallback*
successCallback, ErrorCallback* errorCallback) | 150 void DOMFileSystem::createWriter(const FileEntry* fileEntry, FileWriterCallback*
successCallback, ErrorCallback* errorCallback) |
151 { | 151 { |
152 ASSERT(fileEntry); | 152 ASSERT(fileEntry); |
153 | 153 |
154 if (!fileSystem()) { | 154 if (!fileSystem()) { |
155 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); | 155 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
156 return; | 156 return; |
157 } | 157 } |
158 | 158 |
159 FileWriter* fileWriter = FileWriter::create(executionContext()); | 159 FileWriter* fileWriter = FileWriter::create(getExecutionContext()); |
160 FileWriterBaseCallback* conversionCallback = ConvertToFileWriterCallback::cr
eate(successCallback); | 160 FileWriterBaseCallback* conversionCallback = ConvertToFileWriterCallback::cr
eate(successCallback); |
161 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create
(fileWriter, conversionCallback, errorCallback, m_context); | 161 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create
(fileWriter, conversionCallback, errorCallback, m_context); |
162 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c
allbacks.release()); | 162 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c
allbacks.release()); |
163 } | 163 } |
164 | 164 |
165 void DOMFileSystem::createFile(const FileEntry* fileEntry, BlobCallback* success
Callback, ErrorCallback* errorCallback) | 165 void DOMFileSystem::createFile(const FileEntry* fileEntry, BlobCallback* success
Callback, ErrorCallback* errorCallback) |
166 { | 166 { |
167 KURL fileSystemURL = createFileSystemURL(fileEntry); | 167 KURL fileSystemURL = createFileSystemURL(fileEntry); |
168 if (!fileSystem()) { | 168 if (!fileSystem()) { |
169 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); | 169 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC
allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa
llback, m_context)); | 173 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC
allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa
llback, m_context)); |
174 } | 174 } |
175 | 175 |
176 DEFINE_TRACE(DOMFileSystem) | 176 DEFINE_TRACE(DOMFileSystem) |
177 { | 177 { |
178 DOMFileSystemBase::trace(visitor); | 178 DOMFileSystemBase::trace(visitor); |
179 ActiveDOMObject::trace(visitor); | 179 ActiveDOMObject::trace(visitor); |
180 visitor->trace(m_rootEntry); | 180 visitor->trace(m_rootEntry); |
181 } | 181 } |
182 | 182 |
183 } // namespace blink | 183 } // namespace blink |
OLD | NEW |