| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return new File(path, displayName, File::AllContentTypes, File::IsUserVi
sible); | 97 return new File(path, displayName, File::AllContentTypes, File::IsUserVi
sible); |
| 98 } | 98 } |
| 99 | 99 |
| 100 static File* createForFileSystemFile(const String& path, const String& name,
ContentTypeLookupPolicy policy = WellKnownContentTypes) | 100 static File* createForFileSystemFile(const String& path, const String& name,
ContentTypeLookupPolicy policy = WellKnownContentTypes) |
| 101 { | 101 { |
| 102 if (name.isEmpty()) | 102 if (name.isEmpty()) |
| 103 return new File(path, policy, File::IsNotUserVisible); | 103 return new File(path, policy, File::IsNotUserVisible); |
| 104 return new File(path, name, policy, File::IsNotUserVisible); | 104 return new File(path, name, policy, File::IsNotUserVisible); |
| 105 } | 105 } |
| 106 | 106 |
| 107 File* clone(const String& name = String()) const; |
| 108 |
| 107 virtual unsigned long long size() const override; | 109 virtual unsigned long long size() const override; |
| 108 virtual Blob* slice(long long start, long long end, const String& contentTyp
e, ExceptionState&) const override; | 110 virtual Blob* slice(long long start, long long end, const String& contentTyp
e, ExceptionState&) const override; |
| 109 virtual void close(ExecutionContext*, ExceptionState&) override; | 111 virtual void close(ExecutionContext*, ExceptionState&) override; |
| 110 | 112 |
| 111 virtual bool isFile() const override { return true; } | 113 virtual bool isFile() const override { return true; } |
| 112 virtual bool hasBackingFile() const override { return m_hasBackingFile; } | 114 virtual bool hasBackingFile() const override { return m_hasBackingFile; } |
| 113 | 115 |
| 114 virtual void appendTo(BlobData&) const override; | 116 virtual void appendTo(BlobData&) const override; |
| 115 | 117 |
| 116 const String& path() const { ASSERT(hasValidFilePath()); return m_path; } | 118 const String& path() const { ASSERT(hasValidFilePath()); return m_path; } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 138 // Returns true if the sources (file path, file system URL, or blob handler)
of the file objects are same or not. | 140 // Returns true if the sources (file path, file system URL, or blob handler)
of the file objects are same or not. |
| 139 bool hasSameSource(const File& other) const; | 141 bool hasSameSource(const File& other) const; |
| 140 | 142 |
| 141 private: | 143 private: |
| 142 File(const String& path, ContentTypeLookupPolicy, UserVisibility); | 144 File(const String& path, ContentTypeLookupPolicy, UserVisibility); |
| 143 File(const String& path, const String& name, ContentTypeLookupPolicy, UserVi
sibility); | 145 File(const String& path, const String& name, ContentTypeLookupPolicy, UserVi
sibility); |
| 144 File(const String& path, const String& name, const String& relativePath, Use
rVisibility, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr
<BlobDataHandle>); | 146 File(const String& path, const String& name, const String& relativePath, Use
rVisibility, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr
<BlobDataHandle>); |
| 145 File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle>
); | 147 File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle>
); |
| 146 File(const String& name, const FileMetadata&, UserVisibility); | 148 File(const String& name, const FileMetadata&, UserVisibility); |
| 147 File(const KURL& fileSystemURL, const FileMetadata&, UserVisibility); | 149 File(const KURL& fileSystemURL, const FileMetadata&, UserVisibility); |
| 150 File(const File&); |
| 148 | 151 |
| 149 void invalidateSnapshotMetadata() { m_snapshotSize = -1; } | 152 void invalidateSnapshotMetadata() { m_snapshotSize = -1; } |
| 150 | 153 |
| 151 // Returns File's last modified time (in MS since Epoch.) | 154 // Returns File's last modified time (in MS since Epoch.) |
| 152 // If the modification time isn't known, the current time is returned. | 155 // If the modification time isn't known, the current time is returned. |
| 153 double lastModifiedMS() const; | 156 double lastModifiedMS() const; |
| 154 | 157 |
| 155 #if ENABLE(ASSERT) | 158 #if ENABLE(ASSERT) |
| 156 // Instances backed by a file must have an empty file system URL. | 159 // Instances backed by a file must have an empty file system URL. |
| 157 bool hasValidFileSystemURL() const { return !hasBackingFile() || m_fileSyste
mURL.isEmpty(); } | 160 bool hasValidFileSystemURL() const { return !hasBackingFile() || m_fileSyste
mURL.isEmpty(); } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 172 const double m_snapshotModificationTime; | 175 const double m_snapshotModificationTime; |
| 173 | 176 |
| 174 String m_relativePath; | 177 String m_relativePath; |
| 175 }; | 178 }; |
| 176 | 179 |
| 177 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); | 180 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); |
| 178 | 181 |
| 179 } // namespace blink | 182 } // namespace blink |
| 180 | 183 |
| 181 #endif // File_h | 184 #endif // File_h |
| OLD | NEW |