Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: third_party/WebKit/Source/core/fileapi/File.h

Issue 2394653003: reflow comments in core/events,core/fileapi (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 class ExceptionState; 38 class ExceptionState;
39 class ExecutionContext; 39 class ExecutionContext;
40 class FilePropertyBag; 40 class FilePropertyBag;
41 class FileMetadata; 41 class FileMetadata;
42 class KURL; 42 class KURL;
43 43
44 class CORE_EXPORT File final : public Blob { 44 class CORE_EXPORT File final : public Blob {
45 DEFINE_WRAPPERTYPEINFO(); 45 DEFINE_WRAPPERTYPEINFO();
46 46
47 public: 47 public:
48 // AllContentTypes should only be used when the full path/name are trusted; ot herwise, it could 48 // AllContentTypes should only be used when the full path/name are trusted;
49 // allow arbitrary pages to determine what applications an user has installed. 49 // otherwise, it could allow arbitrary pages to determine what applications an
50 // user has installed.
50 enum ContentTypeLookupPolicy { 51 enum ContentTypeLookupPolicy {
51 WellKnownContentTypes, 52 WellKnownContentTypes,
52 AllContentTypes, 53 AllContentTypes,
53 }; 54 };
54 55
55 // The user should not be able to browse to some files, such as the ones 56 // The user should not be able to browse to some files, such as the ones
56 // generated by the Filesystem API. 57 // generated by the Filesystem API.
57 enum UserVisibility { IsUserVisible, IsNotUserVisible }; 58 enum UserVisibility { IsUserVisible, IsNotUserVisible };
58 59
59 // Constructor in File.idl 60 // Constructor in File.idl
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 uint64_t size, 95 uint64_t size,
95 double lastModified, 96 double lastModified,
96 PassRefPtr<BlobDataHandle> blobDataHandle) { 97 PassRefPtr<BlobDataHandle> blobDataHandle) {
97 return new File(path, name, String(), IsNotUserVisible, true, size, 98 return new File(path, name, String(), IsNotUserVisible, true, size,
98 lastModified, std::move(blobDataHandle)); 99 lastModified, std::move(blobDataHandle));
99 } 100 }
100 101
101 static File* createWithRelativePath(const String& path, 102 static File* createWithRelativePath(const String& path,
102 const String& relativePath); 103 const String& relativePath);
103 104
104 // If filesystem files live in the remote filesystem, the port might pass the valid metadata (whose length field is non-negative) and cache in the File object . 105 // If filesystem files live in the remote filesystem, the port might pass the
106 // valid metadata (whose length field is non-negative) and cache in the File
107 // object.
105 // 108 //
106 // Otherwise calling size(), lastModifiedTime() and slice() will synchronously query the file metadata. 109 // Otherwise calling size(), lastModifiedTime() and slice() will synchronously
110 // query the file metadata.
107 static File* createForFileSystemFile(const String& name, 111 static File* createForFileSystemFile(const String& name,
108 const FileMetadata& metadata, 112 const FileMetadata& metadata,
109 UserVisibility userVisibility) { 113 UserVisibility userVisibility) {
110 return new File(name, metadata, userVisibility); 114 return new File(name, metadata, userVisibility);
111 } 115 }
112 116
113 static File* createForFileSystemFile(const KURL& url, 117 static File* createForFileSystemFile(const KURL& url,
114 const FileMetadata& metadata, 118 const FileMetadata& metadata,
115 UserVisibility userVisibility) { 119 UserVisibility userVisibility) {
116 return new File(url, metadata, userVisibility); 120 return new File(url, metadata, userVisibility);
117 } 121 }
118 122
119 KURL fileSystemURL() const { 123 KURL fileSystemURL() const {
120 ASSERT(hasValidFileSystemURL()); 124 ASSERT(hasValidFileSystemURL());
121 return m_fileSystemURL; 125 return m_fileSystemURL;
122 } 126 }
123 127
124 // Create a file with a name exposed to the author (via File.name and associat ed DOM properties) that differs from the one provided in the path. 128 // Create a file with a name exposed to the author (via File.name and
129 // associated DOM properties) that differs from the one provided in the path.
125 static File* createForUserProvidedFile(const String& path, 130 static File* createForUserProvidedFile(const String& path,
126 const String& displayName) { 131 const String& displayName) {
127 if (displayName.isEmpty()) 132 if (displayName.isEmpty())
128 return new File(path, File::AllContentTypes, File::IsUserVisible); 133 return new File(path, File::AllContentTypes, File::IsUserVisible);
129 return new File(path, displayName, File::AllContentTypes, 134 return new File(path, displayName, File::AllContentTypes,
130 File::IsUserVisible); 135 File::IsUserVisible);
131 } 136 }
132 137
133 static File* createForFileSystemFile( 138 static File* createForFileSystemFile(
134 const String& path, 139 const String& path,
(...skipping 27 matching lines...) Expand all
162 // Getter for the lastModified IDL attribute, 167 // Getter for the lastModified IDL attribute,
163 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs 168 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs
164 long long lastModified() const; 169 long long lastModified() const;
165 170
166 // Getter for the lastModifiedDate IDL attribute, 171 // Getter for the lastModifiedDate IDL attribute,
167 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate 172 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate
168 double lastModifiedDate() const; 173 double lastModifiedDate() const;
169 174
170 UserVisibility getUserVisibility() const { return m_userVisibility; } 175 UserVisibility getUserVisibility() const { return m_userVisibility; }
171 176
172 // Returns the relative path of this file in the context of a directory select ion. 177 // Returns the relative path of this file in the context of a directory
178 // selection.
173 const String& webkitRelativePath() const { return m_relativePath; } 179 const String& webkitRelativePath() const { return m_relativePath; }
174 180
175 // Note that this involves synchronous file operation. Think twice before call ing this function. 181 // Note that this involves synchronous file operation. Think twice before
182 // calling this function.
176 void captureSnapshot(long long& snapshotSize, 183 void captureSnapshot(long long& snapshotSize,
177 double& snapshotModificationTimeMS) const; 184 double& snapshotModificationTimeMS) const;
178 185
179 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >= 0). 186 // Returns true if this has a valid snapshot metadata
187 // (i.e. m_snapshotSize >= 0).
180 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } 188 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; }
181 189
182 // Returns true if the sources (file path, file system URL, or blob handler) o f the file objects are same or not. 190 // Returns true if the sources (file path, file system URL, or blob handler)
191 // of the file objects are same or not.
183 bool hasSameSource(const File& other) const; 192 bool hasSameSource(const File& other) const;
184 193
185 private: 194 private:
186 File(const String& path, ContentTypeLookupPolicy, UserVisibility); 195 File(const String& path, ContentTypeLookupPolicy, UserVisibility);
187 File(const String& path, 196 File(const String& path,
188 const String& name, 197 const String& name,
189 ContentTypeLookupPolicy, 198 ContentTypeLookupPolicy,
190 UserVisibility); 199 UserVisibility);
191 File(const String& path, 200 File(const String& path,
192 const String& name, 201 const String& name,
(...skipping 23 matching lines...) Expand all
216 bool hasValidFilePath() const { return hasBackingFile() || m_path.isEmpty(); } 225 bool hasValidFilePath() const { return hasBackingFile() || m_path.isEmpty(); }
217 #endif 226 #endif
218 227
219 bool m_hasBackingFile; 228 bool m_hasBackingFile;
220 UserVisibility m_userVisibility; 229 UserVisibility m_userVisibility;
221 String m_path; 230 String m_path;
222 String m_name; 231 String m_name;
223 232
224 KURL m_fileSystemURL; 233 KURL m_fileSystemURL;
225 234
226 // If m_snapshotSize is negative (initialized to -1 by default), the snapshot metadata is invalid and we retrieve the latest metadata synchronously in size(), lastModifiedTime() and slice(). 235 // If m_snapshotSize is negative (initialized to -1 by default), the snapshot
236 // metadata is invalid and we retrieve the latest metadata synchronously in
237 // size(), lastModifiedTime() and slice().
227 // Otherwise, the snapshot metadata are used directly in those methods. 238 // Otherwise, the snapshot metadata are used directly in those methods.
228 long long m_snapshotSize; 239 long long m_snapshotSize;
229 const double m_snapshotModificationTimeMS; 240 const double m_snapshotModificationTimeMS;
230 241
231 String m_relativePath; 242 String m_relativePath;
232 }; 243 };
233 244
234 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); 245 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile());
235 246
236 } // namespace blink 247 } // namespace blink
237 248
238 #endif // File_h 249 #endif // File_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/Blob.h ('k') | third_party/WebKit/Source/core/fileapi/File.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698