| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2  * Copyright (C) 2008 Apple 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 | 5  * modification, are permitted provided that the following conditions | 
| 6  * are met: | 6  * are met: | 
| 7  * 1. Redistributions of source code must retain the above copyright | 7  * 1. Redistributions of source code must retain the above copyright | 
| 8  *    notice, this list of conditions and the following disclaimer. | 8  *    notice, this list of conditions and the following disclaimer. | 
| 9  * 2. Redistributions in binary form must reproduce the above copyright | 9  * 2. Redistributions in binary form must reproduce the above copyright | 
| 10  *    notice, this list of conditions and the following disclaimer in the | 10  *    notice, this list of conditions and the following disclaimer in the | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 52     static PassRefPtr<File> create(const String& name, double modificationTime, 
     PassRefPtr<BlobDataHandle> blobDataHandle) | 52     static PassRefPtr<File> create(const String& name, double modificationTime, 
     PassRefPtr<BlobDataHandle> blobDataHandle) | 
| 53     { | 53     { | 
| 54         return adoptRef(new File(name, modificationTime, blobDataHandle)); | 54         return adoptRef(new File(name, modificationTime, blobDataHandle)); | 
| 55     } | 55     } | 
| 56 | 56 | 
| 57     // For deserialization. | 57     // For deserialization. | 
| 58     static PassRefPtr<File> create(const String& path, PassRefPtr<BlobDataHandle
     > blobDataHandle) | 58     static PassRefPtr<File> create(const String& path, PassRefPtr<BlobDataHandle
     > blobDataHandle) | 
| 59     { | 59     { | 
| 60         return adoptRef(new File(path, blobDataHandle)); | 60         return adoptRef(new File(path, blobDataHandle)); | 
| 61     } | 61     } | 
|  | 62     static PassRefPtr<File> create(const String& path, const String& name, PassR
     efPtr<BlobDataHandle> blobDataHandle, double lastModified, long long size) | 
|  | 63     { | 
|  | 64         return adoptRef(new File(path, name, blobDataHandle, lastModified, size)
     ); | 
|  | 65     } | 
| 62 | 66 | 
| 63     static PassRefPtr<File> createWithRelativePath(const String& path, const Str
     ing& relativePath); | 67     static PassRefPtr<File> createWithRelativePath(const String& path, const Str
     ing& relativePath); | 
| 64 | 68 | 
| 65     // If filesystem files live in the remote filesystem, the port might pass th
     e valid metadata (whose length field is non-negative) and cache in the File obje
     ct. | 69     // If filesystem files live in the remote filesystem, the port might pass th
     e valid metadata (whose length field is non-negative) and cache in the File obje
     ct. | 
| 66     // | 70     // | 
| 67     // Otherwise calling size(), lastModifiedTime() and slice() will synchronous
     ly query the file metadata. | 71     // Otherwise calling size(), lastModifiedTime() and slice() will synchronous
     ly query the file metadata. | 
| 68     static PassRefPtr<File> createForFileSystemFile(const String& name, const Fi
     leMetadata& metadata) | 72     static PassRefPtr<File> createForFileSystemFile(const String& name, const Fi
     leMetadata& metadata) | 
| 69     { | 73     { | 
| 70         return adoptRef(new File(name, metadata)); | 74         return adoptRef(new File(name, metadata)); | 
| 71     } | 75     } | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 85         return adoptRef(new File(path, name, policy)); | 89         return adoptRef(new File(path, name, policy)); | 
| 86     } | 90     } | 
| 87 | 91 | 
| 88     virtual unsigned long long size() const OVERRIDE; | 92     virtual unsigned long long size() const OVERRIDE; | 
| 89     virtual bool isFile() const OVERRIDE { return true; } | 93     virtual bool isFile() const OVERRIDE { return true; } | 
| 90     virtual bool hasBackingFile() const OVERRIDE { return m_hasBackingFile; } | 94     virtual bool hasBackingFile() const OVERRIDE { return m_hasBackingFile; } | 
| 91 | 95 | 
| 92     const String& path() const { ASSERT(m_hasBackingFile); return m_path; } | 96     const String& path() const { ASSERT(m_hasBackingFile); return m_path; } | 
| 93     const String& name() const { return m_name; } | 97     const String& name() const { return m_name; } | 
| 94 | 98 | 
| 95     // This returns the current date and time if the file's last modifiecation d
     ate is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate). | 99     // This returns the current date and time if the file's last modification da
     te is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate). | 
| 96     double lastModifiedDate() const; | 100     double lastModifiedDate() const; | 
| 97 | 101 | 
| 98     // Returns the relative path of this file in the context of a directory sele
     ction. | 102     // Returns the relative path of this file in the context of a directory sele
     ction. | 
| 99     const String& webkitRelativePath() const { return m_relativePath; } | 103     const String& webkitRelativePath() const { return m_relativePath; } | 
| 100 | 104 | 
| 101     // Note that this involves synchronous file operation. Think twice before ca
     lling this function. | 105     // Note that this involves synchronous file operation. Think twice before ca
     lling this function. | 
| 102     void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
     me) const; | 106     void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
     me) const; | 
| 103 | 107 | 
| 104 private: | 108 private: | 
| 105     File(const String& path, ContentTypeLookupPolicy); | 109     File(const String& path, ContentTypeLookupPolicy); | 
|  | 110     // For deserialization. | 
|  | 111     File(const String& path, const String& name, PassRefPtr<BlobDataHandle>, dou
     ble lastModified, long long size); | 
| 106     File(const String& path, const String& name, ContentTypeLookupPolicy); | 112     File(const String& path, const String& name, ContentTypeLookupPolicy); | 
| 107     File(const String& path, PassRefPtr<BlobDataHandle>); | 113     File(const String& path, PassRefPtr<BlobDataHandle>); | 
| 108     File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle>
     ); | 114     File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle>
     ); | 
| 109     File(const String& name, const FileMetadata&); | 115     File(const String& name, const FileMetadata&); | 
| 110     File(const KURL& fileSystemURL, const FileMetadata&); | 116     File(const KURL& fileSystemURL, const FileMetadata&); | 
| 111 | 117 | 
| 112     // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
     = 0). | 118     // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
     = 0). | 
| 113     bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } | 119     bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } | 
| 114 | 120 | 
| 115     bool m_hasBackingFile; | 121     bool m_hasBackingFile; | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 134 | 140 | 
| 135 inline const File* toFile(const Blob* blob) | 141 inline const File* toFile(const Blob* blob) | 
| 136 { | 142 { | 
| 137     ASSERT_WITH_SECURITY_IMPLICATION(!blob || blob->isFile()); | 143     ASSERT_WITH_SECURITY_IMPLICATION(!blob || blob->isFile()); | 
| 138     return static_cast<const File*>(blob); | 144     return static_cast<const File*>(blob); | 
| 139 } | 145 } | 
| 140 | 146 | 
| 141 } // namespace WebCore | 147 } // namespace WebCore | 
| 142 | 148 | 
| 143 #endif // File_h | 149 #endif // File_h | 
| OLD | NEW | 
|---|