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 20 matching lines...) Expand all Loading... |
31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
32 #include "wtf/text/WTFString.h" | 32 #include "wtf/text/WTFString.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class ExceptionState; | 36 class ExceptionState; |
37 class ExecutionContext; | 37 class ExecutionContext; |
38 struct FileMetadata; | 38 struct FileMetadata; |
39 class KURL; | 39 class KURL; |
40 | 40 |
41 class File FINAL : public Blob { | 41 class File final : public Blob { |
42 DEFINE_WRAPPERTYPEINFO(); | 42 DEFINE_WRAPPERTYPEINFO(); |
43 public: | 43 public: |
44 // AllContentTypes should only be used when the full path/name are trusted;
otherwise, it could | 44 // AllContentTypes should only be used when the full path/name are trusted;
otherwise, it could |
45 // allow arbitrary pages to determine what applications an user has installe
d. | 45 // allow arbitrary pages to determine what applications an user has installe
d. |
46 enum ContentTypeLookupPolicy { | 46 enum ContentTypeLookupPolicy { |
47 WellKnownContentTypes, | 47 WellKnownContentTypes, |
48 AllContentTypes, | 48 AllContentTypes, |
49 }; | 49 }; |
50 | 50 |
51 // The user should not be able to browse to some files, such as the ones | 51 // The user should not be able to browse to some files, such as the ones |
(...skipping 45 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 virtual unsigned long long size() const OVERRIDE; | 107 virtual unsigned long long size() const override; |
108 virtual Blob* slice(long long start, long long end, const String& contentTyp
e, ExceptionState&) const OVERRIDE; | 108 virtual Blob* slice(long long start, long long end, const String& contentTyp
e, ExceptionState&) const override; |
109 virtual void close(ExecutionContext*, ExceptionState&) OVERRIDE; | 109 virtual void close(ExecutionContext*, ExceptionState&) override; |
110 | 110 |
111 virtual bool isFile() const OVERRIDE { return true; } | 111 virtual bool isFile() const override { return true; } |
112 virtual bool hasBackingFile() const OVERRIDE { return m_hasBackingFile; } | 112 virtual bool hasBackingFile() const override { return m_hasBackingFile; } |
113 | 113 |
114 virtual void appendTo(BlobData&) const OVERRIDE; | 114 virtual void appendTo(BlobData&) const override; |
115 | 115 |
116 const String& path() const { ASSERT(hasValidFilePath()); return m_path; } | 116 const String& path() const { ASSERT(hasValidFilePath()); return m_path; } |
117 const String name() const { return m_name; } | 117 const String name() const { return m_name; } |
118 | 118 |
119 // Getter for the lastModified IDL attribute, | 119 // Getter for the lastModified IDL attribute, |
120 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs | 120 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs |
121 long long lastModified() const; | 121 long long lastModified() const; |
122 | 122 |
123 // Getter for the lastModifiedDate IDL attribute, | 123 // Getter for the lastModifiedDate IDL attribute, |
124 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate | 124 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 const double m_snapshotModificationTime; | 168 const double m_snapshotModificationTime; |
169 | 169 |
170 String m_relativePath; | 170 String m_relativePath; |
171 }; | 171 }; |
172 | 172 |
173 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); | 173 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); |
174 | 174 |
175 } // namespace blink | 175 } // namespace blink |
176 | 176 |
177 #endif // File_h | 177 #endif // File_h |
OLD | NEW |