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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp

Issue 2388423003: reflow comments in modules/[fetch,indexeddb] (Closed)
Patch Set: rebase 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 KURL DOMFileSystemBase::createFileSystemURL(const EntryBase* entry) const { 114 KURL DOMFileSystemBase::createFileSystemURL(const EntryBase* entry) const {
115 return createFileSystemURL(entry->fullPath()); 115 return createFileSystemURL(entry->fullPath());
116 } 116 }
117 117
118 KURL DOMFileSystemBase::createFileSystemURL(const String& fullPath) const { 118 KURL DOMFileSystemBase::createFileSystemURL(const String& fullPath) const {
119 ASSERT(DOMFilePath::isAbsolute(fullPath)); 119 ASSERT(DOMFilePath::isAbsolute(fullPath));
120 120
121 if (type() == FileSystemTypeExternal) { 121 if (type() == FileSystemTypeExternal) {
122 // For external filesystem originString could be different from what we have in m_filesystemRootURL. 122 // For external filesystem originString could be different from what we have
123 // in m_filesystemRootURL.
123 StringBuilder result; 124 StringBuilder result;
124 result.append("filesystem:"); 125 result.append("filesystem:");
125 result.append(getSecurityOrigin()->toString()); 126 result.append(getSecurityOrigin()->toString());
126 result.append('/'); 127 result.append('/');
127 result.append(externalPathPrefix); 128 result.append(externalPathPrefix);
128 result.append(m_filesystemRootURL.path()); 129 result.append(m_filesystemRootURL.path());
129 // Remove the extra leading slash. 130 // Remove the extra leading slash.
130 result.append(encodeWithURLEscapeSequences(fullPath.substring(1))); 131 result.append(encodeWithURLEscapeSequences(fullPath.substring(1)));
131 return KURL(ParsedURLString, result.toString()); 132 return KURL(ParsedURLString, result.toString());
132 } 133 }
133 134
134 // For regular types we can just append the entry's fullPath to the m_filesyst emRootURL that should look like 'filesystem:<origin>/<typePrefix>'. 135 // For regular types we can just append the entry's fullPath to the
136 // m_filesystemRootURL that should look like
137 // 'filesystem:<origin>/<typePrefix>'.
135 ASSERT(!m_filesystemRootURL.isEmpty()); 138 ASSERT(!m_filesystemRootURL.isEmpty());
136 KURL url = m_filesystemRootURL; 139 KURL url = m_filesystemRootURL;
137 // Remove the extra leading slash. 140 // Remove the extra leading slash.
138 url.setPath(url.path() + encodeWithURLEscapeSequences(fullPath.substring(1))); 141 url.setPath(url.path() + encodeWithURLEscapeSequences(fullPath.substring(1)));
139 return url; 142 return url;
140 } 143 }
141 144
142 bool DOMFileSystemBase::pathToAbsolutePath(FileSystemType type, 145 bool DOMFileSystemBase::pathToAbsolutePath(FileSystemType type,
143 const EntryBase* base, 146 const EntryBase* base,
144 String path, 147 String path,
(...skipping 26 matching lines...) Expand all
171 return true; 174 return true;
172 } 175 }
173 176
174 return false; 177 return false;
175 } 178 }
176 179
177 File* DOMFileSystemBase::createFile(const FileMetadata& metadata, 180 File* DOMFileSystemBase::createFile(const FileMetadata& metadata,
178 const KURL& fileSystemURL, 181 const KURL& fileSystemURL,
179 FileSystemType type, 182 FileSystemType type,
180 const String name) { 183 const String name) {
181 // For regular filesystem types (temporary or persistent), we should not cache file metadata as it could change File semantics. 184 // For regular filesystem types (temporary or persistent), we should not cache
182 // For other filesystem types (which could be platform-specific ones), there's a chance that the files are on remote filesystem. 185 // file metadata as it could change File semantics. For other filesystem
183 // If the port has returned metadata just pass it to File constructor (so we m ay cache the metadata). 186 // types (which could be platform-specific ones), there's a chance that the
187 // files are on remote filesystem. If the port has returned metadata just
188 // pass it to File constructor (so we may cache the metadata).
184 // FIXME: We should use the snapshot metadata for all files. 189 // FIXME: We should use the snapshot metadata for all files.
185 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 190 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746
186 if (type == FileSystemTypeTemporary || type == FileSystemTypePersistent) 191 if (type == FileSystemTypeTemporary || type == FileSystemTypePersistent)
187 return File::createForFileSystemFile(metadata.platformPath, name); 192 return File::createForFileSystemFile(metadata.platformPath, name);
188 193
189 const File::UserVisibility userVisibility = (type == FileSystemTypeExternal) 194 const File::UserVisibility userVisibility = (type == FileSystemTypeExternal)
190 ? File::IsUserVisible 195 ? File::IsUserVisible
191 : File::IsNotUserVisible; 196 : File::IsNotUserVisible;
192 197
193 if (!metadata.platformPath.isEmpty()) { 198 if (!metadata.platformPath.isEmpty()) {
194 // If the platformPath in the returned metadata is given, we create a File o bject for the snapshot path. 199 // If the platformPath in the returned metadata is given, we create a File
200 // object for the snapshot path.
195 return File::createForFileSystemFile(name, metadata, userVisibility); 201 return File::createForFileSystemFile(name, metadata, userVisibility);
196 } else { 202 } else {
197 // Otherwise we create a File object for the fileSystemURL. 203 // Otherwise we create a File object for the fileSystemURL.
198 return File::createForFileSystemFile(fileSystemURL, metadata, 204 return File::createForFileSystemFile(fileSystemURL, metadata,
199 userVisibility); 205 userVisibility);
200 } 206 }
201 } 207 }
202 208
203 void DOMFileSystemBase::getMetadata(const EntryBase* entry, 209 void DOMFileSystemBase::getMetadata(const EntryBase* entry,
204 MetadataCallback* successCallback, 210 MetadataCallback* successCallback,
(...skipping 18 matching lines...) Expand all
223 229
224 if (!parent || !parent->isDirectory()) 230 if (!parent || !parent->isDirectory())
225 return false; 231 return false;
226 232
227 if (!newName.isEmpty() && !DOMFilePath::isValidName(newName)) 233 if (!newName.isEmpty() && !DOMFilePath::isValidName(newName))
228 return false; 234 return false;
229 235
230 const bool isSameFileSystem = 236 const bool isSameFileSystem =
231 (*source->filesystem() == *parent->filesystem()); 237 (*source->filesystem() == *parent->filesystem());
232 238
233 // It is an error to try to copy or move an entry inside itself at any depth i f it is a directory. 239 // It is an error to try to copy or move an entry inside itself at any depth
240 // if it is a directory.
234 if (source->isDirectory() && isSameFileSystem && 241 if (source->isDirectory() && isSameFileSystem &&
235 DOMFilePath::isParentOf(source->fullPath(), parent->fullPath())) 242 DOMFilePath::isParentOf(source->fullPath(), parent->fullPath()))
236 return false; 243 return false;
237 244
238 // It is an error to copy or move an entry into its parent if a name different from its current one isn't provided. 245 // It is an error to copy or move an entry into its parent if a name different
246 // from its current one isn't provided.
239 if (isSameFileSystem && (newName.isEmpty() || source->name() == newName) && 247 if (isSameFileSystem && (newName.isEmpty() || source->name() == newName) &&
240 DOMFilePath::getDirectory(source->fullPath()) == parent->fullPath()) 248 DOMFilePath::getDirectory(source->fullPath()) == parent->fullPath())
241 return false; 249 return false;
242 250
243 destinationPath = parent->fullPath(); 251 destinationPath = parent->fullPath();
244 if (!newName.isEmpty()) 252 if (!newName.isEmpty())
245 destinationPath = DOMFilePath::append(destinationPath, newName); 253 destinationPath = DOMFilePath::append(destinationPath, newName);
246 else 254 else
247 destinationPath = DOMFilePath::append(destinationPath, source->name()); 255 destinationPath = DOMFilePath::append(destinationPath, source->name());
248 256
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 std::move(callbacks)); 455 std::move(callbacks));
448 } 456 }
449 457
450 bool DOMFileSystemBase::waitForAdditionalResult(int callbacksId) { 458 bool DOMFileSystemBase::waitForAdditionalResult(int callbacksId) {
451 if (!fileSystem()) 459 if (!fileSystem())
452 return false; 460 return false;
453 return fileSystem()->waitForAdditionalResult(callbacksId); 461 return fileSystem()->waitForAdditionalResult(callbacksId);
454 } 462 }
455 463
456 } // namespace blink 464 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698