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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 OwnPtr<FileWriterCallback> m_callback; | 140 OwnPtr<FileWriterCallback> m_callback; |
141 }; | 141 }; |
142 | 142 |
143 } | 143 } |
144 | 144 |
145 void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassOwnPtr<FileWrit
erCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback) | 145 void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassOwnPtr<FileWrit
erCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback) |
146 { | 146 { |
147 ASSERT(fileEntry); | 147 ASSERT(fileEntry); |
148 | 148 |
| 149 if (!fileSystem()) { |
| 150 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
| 151 return; |
| 152 } |
| 153 |
149 FileWriter* fileWriter = FileWriter::create(executionContext()); | 154 FileWriter* fileWriter = FileWriter::create(executionContext()); |
150 OwnPtr<FileWriterBaseCallback> conversionCallback = ConvertToFileWriterCallb
ack::create(successCallback); | 155 OwnPtr<FileWriterBaseCallback> conversionCallback = ConvertToFileWriterCallb
ack::create(successCallback); |
151 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create
(fileWriter, conversionCallback.release(), errorCallback, m_context); | 156 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create
(fileWriter, conversionCallback.release(), errorCallback, m_context); |
152 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c
allbacks.release()); | 157 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c
allbacks.release()); |
153 } | 158 } |
154 | 159 |
155 void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtr<FileCallba
ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback) | 160 void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtr<FileCallba
ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback) |
156 { | 161 { |
157 KURL fileSystemURL = createFileSystemURL(fileEntry); | 162 KURL fileSystemURL = createFileSystemURL(fileEntry); |
| 163 if (!fileSystem()) { |
| 164 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
| 165 return; |
| 166 } |
| 167 |
158 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC
allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa
llback, m_context)); | 168 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC
allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa
llback, m_context)); |
159 } | 169 } |
160 | 170 |
161 } // namespace blink | 171 } // namespace blink |
OLD | NEW |