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

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

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return File::createForFileSystemFile(name, metadata, userVisibility); 210 return File::createForFileSystemFile(name, metadata, userVisibility);
211 } else { 211 } else {
212 // Otherwise we create a File object for the fileSystemURL. 212 // Otherwise we create a File object for the fileSystemURL.
213 return File::createForFileSystemFile(fileSystemURL, metadata, userVisibi lity); 213 return File::createForFileSystemFile(fileSystemURL, metadata, userVisibi lity);
214 } 214 }
215 } 215 }
216 216
217 void DOMFileSystemBase::getMetadata(const EntryBase* entry, MetadataCallback* su ccessCallback, ErrorCallbackBase* errorCallback, SynchronousType synchronousType ) 217 void DOMFileSystemBase::getMetadata(const EntryBase* entry, MetadataCallback* su ccessCallback, ErrorCallbackBase* errorCallback, SynchronousType synchronousType )
218 { 218 {
219 if (!fileSystem()) { 219 if (!fileSystem()) {
220 reportError(errorCallback, FileError::ABORT_ERR); 220 reportError(errorCallback, FileError::kAbortErr);
221 return; 221 return;
222 } 222 }
223 223
224 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::creat e(successCallback, errorCallback, m_context, this)); 224 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::creat e(successCallback, errorCallback, m_context, this));
225 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 225 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
226 fileSystem()->readMetadata(createFileSystemURL(entry), std::move(callbacks)) ; 226 fileSystem()->readMetadata(createFileSystemURL(entry), std::move(callbacks)) ;
227 } 227 }
228 228
229 static bool verifyAndGetDestinationPathForCopyOrMove(const EntryBase* source, En tryBase* parent, const String& newName, String& destinationPath) 229 static bool verifyAndGetDestinationPathForCopyOrMove(const EntryBase* source, En tryBase* parent, const String& newName, String& destinationPath)
230 { 230 {
(...skipping 20 matching lines...) Expand all
251 destinationPath = DOMFilePath::append(destinationPath, newName); 251 destinationPath = DOMFilePath::append(destinationPath, newName);
252 else 252 else
253 destinationPath = DOMFilePath::append(destinationPath, source->name()); 253 destinationPath = DOMFilePath::append(destinationPath, source->name());
254 254
255 return true; 255 return true;
256 } 256 }
257 257
258 void DOMFileSystemBase::move(const EntryBase* source, EntryBase* parent, const S tring& newName, EntryCallback* successCallback, ErrorCallbackBase* errorCallback , SynchronousType synchronousType) 258 void DOMFileSystemBase::move(const EntryBase* source, EntryBase* parent, const S tring& newName, EntryCallback* successCallback, ErrorCallbackBase* errorCallback , SynchronousType synchronousType)
259 { 259 {
260 if (!fileSystem()) { 260 if (!fileSystem()) {
261 reportError(errorCallback, FileError::ABORT_ERR); 261 reportError(errorCallback, FileError::kAbortErr);
262 return; 262 return;
263 } 263 }
264 264
265 String destinationPath; 265 String destinationPath;
266 if (!verifyAndGetDestinationPathForCopyOrMove(source, parent, newName, desti nationPath)) { 266 if (!verifyAndGetDestinationPathForCopyOrMove(source, parent, newName, desti nationPath)) {
267 reportError(errorCallback, FileError::INVALID_MODIFICATION_ERR); 267 reportError(errorCallback, FileError::kInvalidModificationErr);
268 return; 268 return;
269 } 269 }
270 270
271 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); 271 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory()));
272 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 272 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
273 273
274 fileSystem()->move(createFileSystemURL(source), parent->filesystem()->create FileSystemURL(destinationPath), std::move(callbacks)); 274 fileSystem()->move(createFileSystemURL(source), parent->filesystem()->create FileSystemURL(destinationPath), std::move(callbacks));
275 } 275 }
276 276
277 void DOMFileSystemBase::copy(const EntryBase* source, EntryBase* parent, const S tring& newName, EntryCallback* successCallback, ErrorCallbackBase* errorCallback , SynchronousType synchronousType) 277 void DOMFileSystemBase::copy(const EntryBase* source, EntryBase* parent, const S tring& newName, EntryCallback* successCallback, ErrorCallbackBase* errorCallback , SynchronousType synchronousType)
278 { 278 {
279 if (!fileSystem()) { 279 if (!fileSystem()) {
280 reportError(errorCallback, FileError::ABORT_ERR); 280 reportError(errorCallback, FileError::kAbortErr);
281 return; 281 return;
282 } 282 }
283 283
284 String destinationPath; 284 String destinationPath;
285 if (!verifyAndGetDestinationPathForCopyOrMove(source, parent, newName, desti nationPath)) { 285 if (!verifyAndGetDestinationPathForCopyOrMove(source, parent, newName, desti nationPath)) {
286 reportError(errorCallback, FileError::INVALID_MODIFICATION_ERR); 286 reportError(errorCallback, FileError::kInvalidModificationErr);
287 return; 287 return;
288 } 288 }
289 289
290 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); 290 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory()));
291 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 291 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
292 292
293 fileSystem()->copy(createFileSystemURL(source), parent->filesystem()->create FileSystemURL(destinationPath), std::move(callbacks)); 293 fileSystem()->copy(createFileSystemURL(source), parent->filesystem()->create FileSystemURL(destinationPath), std::move(callbacks));
294 } 294 }
295 295
296 void DOMFileSystemBase::remove(const EntryBase* entry, VoidCallback* successCall back, ErrorCallbackBase* errorCallback, SynchronousType synchronousType) 296 void DOMFileSystemBase::remove(const EntryBase* entry, VoidCallback* successCall back, ErrorCallbackBase* errorCallback, SynchronousType synchronousType)
297 { 297 {
298 if (!fileSystem()) { 298 if (!fileSystem()) {
299 reportError(errorCallback, FileError::ABORT_ERR); 299 reportError(errorCallback, FileError::kAbortErr);
300 return; 300 return;
301 } 301 }
302 302
303 ASSERT(entry); 303 ASSERT(entry);
304 // We don't allow calling remove() on the root directory. 304 // We don't allow calling remove() on the root directory.
305 if (entry->fullPath() == String(DOMFilePath::root)) { 305 if (entry->fullPath() == String(DOMFilePath::root)) {
306 reportError(errorCallback, FileError::INVALID_MODIFICATION_ERR); 306 reportError(errorCallback, FileError::kInvalidModificationErr);
307 return; 307 return;
308 } 308 }
309 309
310 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(su ccessCallback, errorCallback, m_context, this)); 310 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(su ccessCallback, errorCallback, m_context, this));
311 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 311 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
312 312
313 fileSystem()->remove(createFileSystemURL(entry), std::move(callbacks)); 313 fileSystem()->remove(createFileSystemURL(entry), std::move(callbacks));
314 } 314 }
315 315
316 void DOMFileSystemBase::removeRecursively(const EntryBase* entry, VoidCallback* successCallback, ErrorCallbackBase* errorCallback, SynchronousType synchronousTy pe) 316 void DOMFileSystemBase::removeRecursively(const EntryBase* entry, VoidCallback* successCallback, ErrorCallbackBase* errorCallback, SynchronousType synchronousTy pe)
317 { 317 {
318 if (!fileSystem()) { 318 if (!fileSystem()) {
319 reportError(errorCallback, FileError::ABORT_ERR); 319 reportError(errorCallback, FileError::kAbortErr);
320 return; 320 return;
321 } 321 }
322 322
323 ASSERT(entry && entry->isDirectory()); 323 ASSERT(entry && entry->isDirectory());
324 // We don't allow calling remove() on the root directory. 324 // We don't allow calling remove() on the root directory.
325 if (entry->fullPath() == String(DOMFilePath::root)) { 325 if (entry->fullPath() == String(DOMFilePath::root)) {
326 reportError(errorCallback, FileError::INVALID_MODIFICATION_ERR); 326 reportError(errorCallback, FileError::kInvalidModificationErr);
327 return; 327 return;
328 } 328 }
329 329
330 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(su ccessCallback, errorCallback, m_context, this)); 330 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(su ccessCallback, errorCallback, m_context, this));
331 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 331 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
332 332
333 fileSystem()->removeRecursively(createFileSystemURL(entry), std::move(callba cks)); 333 fileSystem()->removeRecursively(createFileSystemURL(entry), std::move(callba cks));
334 } 334 }
335 335
336 void DOMFileSystemBase::getParent(const EntryBase* entry, EntryCallback* success Callback, ErrorCallbackBase* errorCallback) 336 void DOMFileSystemBase::getParent(const EntryBase* entry, EntryCallback* success Callback, ErrorCallbackBase* errorCallback)
337 { 337 {
338 if (!fileSystem()) { 338 if (!fileSystem()) {
339 reportError(errorCallback, FileError::ABORT_ERR); 339 reportError(errorCallback, FileError::kAbortErr);
340 return; 340 return;
341 } 341 }
342 342
343 ASSERT(entry); 343 ASSERT(entry);
344 String path = DOMFilePath::getDirectory(entry->fullPath()); 344 String path = DOMFilePath::getDirectory(entry->fullPath());
345 345
346 fileSystem()->directoryExists(createFileSystemURL(path), EntryCallbacks::cre ate(successCallback, errorCallback, m_context, this, path, true)); 346 fileSystem()->directoryExists(createFileSystemURL(path), EntryCallbacks::cre ate(successCallback, errorCallback, m_context, this, path, true));
347 } 347 }
348 348
349 void DOMFileSystemBase::getFile(const EntryBase* entry, const String& path, cons t FileSystemFlags& flags, EntryCallback* successCallback, ErrorCallbackBase* err orCallback, SynchronousType synchronousType) 349 void DOMFileSystemBase::getFile(const EntryBase* entry, const String& path, cons t FileSystemFlags& flags, EntryCallback* successCallback, ErrorCallbackBase* err orCallback, SynchronousType synchronousType)
350 { 350 {
351 if (!fileSystem()) { 351 if (!fileSystem()) {
352 reportError(errorCallback, FileError::ABORT_ERR); 352 reportError(errorCallback, FileError::kAbortErr);
353 return; 353 return;
354 } 354 }
355 355
356 String absolutePath; 356 String absolutePath;
357 if (!pathToAbsolutePath(m_type, entry, path, absolutePath)) { 357 if (!pathToAbsolutePath(m_type, entry, path, absolutePath)) {
358 reportError(errorCallback, FileError::INVALID_MODIFICATION_ERR); 358 reportError(errorCallback, FileError::kInvalidModificationErr);
359 return; 359 return;
360 } 360 }
361 361
362 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, this, absolutePath, false)); 362 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, this, absolutePath, false));
363 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 363 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
364 364
365 if (flags.createFlag()) 365 if (flags.createFlag())
366 fileSystem()->createFile(createFileSystemURL(absolutePath), flags.exclus ive(), std::move(callbacks)); 366 fileSystem()->createFile(createFileSystemURL(absolutePath), flags.exclus ive(), std::move(callbacks));
367 else 367 else
368 fileSystem()->fileExists(createFileSystemURL(absolutePath), std::move(ca llbacks)); 368 fileSystem()->fileExists(createFileSystemURL(absolutePath), std::move(ca llbacks));
369 } 369 }
370 370
371 void DOMFileSystemBase::getDirectory(const EntryBase* entry, const String& path, const FileSystemFlags& flags, EntryCallback* successCallback, ErrorCallbackBase * errorCallback, SynchronousType synchronousType) 371 void DOMFileSystemBase::getDirectory(const EntryBase* entry, const String& path, const FileSystemFlags& flags, EntryCallback* successCallback, ErrorCallbackBase * errorCallback, SynchronousType synchronousType)
372 { 372 {
373 if (!fileSystem()) { 373 if (!fileSystem()) {
374 reportError(errorCallback, FileError::ABORT_ERR); 374 reportError(errorCallback, FileError::kAbortErr);
375 return; 375 return;
376 } 376 }
377 377
378 String absolutePath; 378 String absolutePath;
379 if (!pathToAbsolutePath(m_type, entry, path, absolutePath)) { 379 if (!pathToAbsolutePath(m_type, entry, path, absolutePath)) {
380 reportError(errorCallback, FileError::INVALID_MODIFICATION_ERR); 380 reportError(errorCallback, FileError::kInvalidModificationErr);
381 return; 381 return;
382 } 382 }
383 383
384 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, this, absolutePath, true)); 384 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(s uccessCallback, errorCallback, m_context, this, absolutePath, true));
385 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 385 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
386 386
387 if (flags.createFlag()) 387 if (flags.createFlag())
388 fileSystem()->createDirectory(createFileSystemURL(absolutePath), flags.e xclusive(), std::move(callbacks)); 388 fileSystem()->createDirectory(createFileSystemURL(absolutePath), flags.e xclusive(), std::move(callbacks));
389 else 389 else
390 fileSystem()->directoryExists(createFileSystemURL(absolutePath), std::mo ve(callbacks)); 390 fileSystem()->directoryExists(createFileSystemURL(absolutePath), std::mo ve(callbacks));
391 } 391 }
392 392
393 int DOMFileSystemBase::readDirectory(DirectoryReaderBase* reader, const String& path, EntriesCallback* successCallback, ErrorCallbackBase* errorCallback, Synchr onousType synchronousType) 393 int DOMFileSystemBase::readDirectory(DirectoryReaderBase* reader, const String& path, EntriesCallback* successCallback, ErrorCallbackBase* errorCallback, Synchr onousType synchronousType)
394 { 394 {
395 if (!fileSystem()) { 395 if (!fileSystem()) {
396 reportError(errorCallback, FileError::ABORT_ERR); 396 reportError(errorCallback, FileError::kAbortErr);
397 return 0; 397 return 0;
398 } 398 }
399 399
400 ASSERT(DOMFilePath::isAbsolute(path)); 400 ASSERT(DOMFilePath::isAbsolute(path));
401 401
402 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create (successCallback, errorCallback, m_context, reader, path)); 402 std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create (successCallback, errorCallback, m_context, reader, path));
403 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 403 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
404 404
405 return fileSystem()->readDirectory(createFileSystemURL(path), std::move(call backs)); 405 return fileSystem()->readDirectory(createFileSystemURL(path), std::move(call backs));
406 } 406 }
407 407
408 bool DOMFileSystemBase::waitForAdditionalResult(int callbacksId) 408 bool DOMFileSystemBase::waitForAdditionalResult(int callbacksId)
409 { 409 {
410 if (!fileSystem()) 410 if (!fileSystem())
411 return false; 411 return false;
412 return fileSystem()->waitForAdditionalResult(callbacksId); 412 return fileSystem()->waitForAdditionalResult(callbacksId);
413 } 413 }
414 414
415 } // namespace blink 415 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698