| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 { | 69 { |
| 70 FileMetadata fileMetadata; | 70 FileMetadata fileMetadata; |
| 71 fileMetadata.modificationTime = webFileInfo.modificationTime; | 71 fileMetadata.modificationTime = webFileInfo.modificationTime; |
| 72 fileMetadata.length = webFileInfo.length; | 72 fileMetadata.length = webFileInfo.length; |
| 73 fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); | 73 fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); |
| 74 fileMetadata.platformPath = webFileInfo.platformPath; | 74 fileMetadata.platformPath = webFileInfo.platformPath; |
| 75 m_callbacks->didReadMetadata(fileMetadata); | 75 m_callbacks->didReadMetadata(fileMetadata); |
| 76 delete this; | 76 delete this; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void WebFileSystemCallbacksImpl::didCreateSnapshotFile(const WebFileInfo& webFil
eInfo) |
| 80 { |
| 81 // It's important to create a BlobDataHandle that refers to the platform fil
e path prior |
| 82 // to return from this method so the underlying file will not be deleted. |
| 83 OwnPtr<BlobData> blobData = BlobData::create(); |
| 84 blobData->appendFile(webFileInfo.platformPath); |
| 85 RefPtr<BlobDataHandle> snapshotBlob = BlobDataHandle::create(blobData.releas
e(), webFileInfo.length); |
| 86 didCreateSnapshotFile(webFileInfo, snapshotBlob); |
| 87 } |
| 88 |
| 89 void WebFileSystemCallbacksImpl::didCreateSnapshotFile(const WebFileInfo& webFil
eInfo, PassRefPtr<WebCore::BlobDataHandle> snapshot) |
| 90 { |
| 91 FileMetadata fileMetadata; |
| 92 fileMetadata.modificationTime = webFileInfo.modificationTime; |
| 93 fileMetadata.length = webFileInfo.length; |
| 94 fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); |
| 95 fileMetadata.platformPath = webFileInfo.platformPath; |
| 96 m_callbacks->didCreateSnapshotFile(fileMetadata, snapshot); |
| 97 delete this; |
| 98 } |
| 99 |
| 79 void WebFileSystemCallbacksImpl::didReadDirectory(const WebVector<WebFileSystemE
ntry>& entries, bool hasMore) | 100 void WebFileSystemCallbacksImpl::didReadDirectory(const WebVector<WebFileSystemE
ntry>& entries, bool hasMore) |
| 80 { | 101 { |
| 81 for (size_t i = 0; i < entries.size(); ++i) | 102 for (size_t i = 0; i < entries.size(); ++i) |
| 82 m_callbacks->didReadDirectoryEntry(entries[i].name, entries[i].isDirecto
ry); | 103 m_callbacks->didReadDirectoryEntry(entries[i].name, entries[i].isDirecto
ry); |
| 83 m_callbacks->didReadDirectoryEntries(hasMore); | 104 m_callbacks->didReadDirectoryEntries(hasMore); |
| 84 delete this; | 105 delete this; |
| 85 } | 106 } |
| 86 | 107 |
| 87 void WebFileSystemCallbacksImpl::didOpenFileSystem(const WebString& name, const
WebURL& rootURL) | 108 void WebFileSystemCallbacksImpl::didOpenFileSystem(const WebString& name, const
WebURL& rootURL) |
| 88 { | 109 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 100 | 121 |
| 101 void WebFileSystemCallbacksImpl::didFail(WebFileError error) | 122 void WebFileSystemCallbacksImpl::didFail(WebFileError error) |
| 102 { | 123 { |
| 103 m_callbacks->didFail(error); | 124 m_callbacks->didFail(error); |
| 104 delete this; | 125 delete this; |
| 105 } | 126 } |
| 106 | 127 |
| 107 } // namespace WebKit | 128 } // namespace WebKit |
| 108 | 129 |
| 109 #endif // ENABLE(FILE_SYSTEM) | 130 #endif // ENABLE(FILE_SYSTEM) |
| OLD | NEW |