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

Side by Side Diff: Source/core/fileapi/File.cpp

Issue 564963002: New FormData methods: get, getAll, has, set, delete and iterable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: webexposed/global-interface-listing updates Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fileapi/File.h ('k') | Source/core/html/DOMFormData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.length)) 152 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.length))
153 , m_hasBackingFile(false) 153 , m_hasBackingFile(false)
154 , m_userVisibility(userVisibility) 154 , m_userVisibility(userVisibility)
155 , m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent())) 155 , m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent()))
156 , m_fileSystemURL(fileSystemURL) 156 , m_fileSystemURL(fileSystemURL)
157 , m_snapshotSize(metadata.length) 157 , m_snapshotSize(metadata.length)
158 , m_snapshotModificationTime(metadata.modificationTime) 158 , m_snapshotModificationTime(metadata.modificationTime)
159 { 159 {
160 } 160 }
161 161
162 File::File(const File& other)
163 : Blob(other.blobDataHandle())
164 , m_hasBackingFile(other.m_hasBackingFile)
165 , m_userVisibility(other.m_userVisibility)
166 , m_path(other.m_path)
167 , m_name(other.m_name)
168 , m_fileSystemURL(other.m_fileSystemURL)
169 , m_snapshotSize(other.m_snapshotSize)
170 , m_snapshotModificationTime(other.m_snapshotModificationTime)
171 , m_relativePath(other.m_relativePath)
172 {
173 }
174
175 File* File::clone(const String& name) const
176 {
177 File* file = new File(*this);
178 if (!name.isNull())
179 file->m_name = name;
180 return file;
181 }
182
162 double File::lastModifiedMS() const 183 double File::lastModifiedMS() const
163 { 184 {
164 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime )) 185 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime ))
165 return m_snapshotModificationTime * msPerSecond; 186 return m_snapshotModificationTime * msPerSecond;
166 187
167 time_t modificationTime; 188 time_t modificationTime;
168 if (hasBackingFile() && getFileModificationTime(m_path, modificationTime) && isValidFileTime(modificationTime)) 189 if (hasBackingFile() && getFileModificationTime(m_path, modificationTime) && isValidFileTime(modificationTime))
169 return modificationTime * msPerSecond; 190 return modificationTime * msPerSecond;
170 191
171 return currentTime() * msPerSecond; 192 return currentTime() * msPerSecond;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty()) 328 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty())
308 return false; 329 return false;
309 330
310 if (!m_fileSystemURL.isEmpty()) 331 if (!m_fileSystemURL.isEmpty())
311 return m_fileSystemURL == other.m_fileSystemURL; 332 return m_fileSystemURL == other.m_fileSystemURL;
312 333
313 return uuid() == other.uuid(); 334 return uuid() == other.uuid();
314 } 335 }
315 336
316 } // namespace blink 337 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/File.h ('k') | Source/core/html/DOMFormData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698