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

Side by Side Diff: Source/modules/filesystem/FileSystemCallbacks.cpp

Issue 516763002: Fix userVisibility for files in ChromeOS filesystems. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 3 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/modules/filesystem/DOMFileSystemSync.cpp ('k') | Source/modules/modules.gypi » ('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) 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 void SnapshotFileCallback::didCreateSnapshotFile(const FileMetadata& metadata, P assRefPtr<BlobDataHandle> snapshot) 305 void SnapshotFileCallback::didCreateSnapshotFile(const FileMetadata& metadata, P assRefPtr<BlobDataHandle> snapshot)
306 { 306 {
307 if (!m_successCallback) 307 if (!m_successCallback)
308 return; 308 return;
309 309
310 // We can't directly use the snapshot blob data handle because the content t ype on it hasn't been set. 310 // We can't directly use the snapshot blob data handle because the content t ype on it hasn't been set.
311 // The |snapshot| param is here to provide a a chain of custody thru thread bridging that is held onto until 311 // The |snapshot| param is here to provide a a chain of custody thru thread bridging that is held onto until
312 // *after* we've coined a File with a new handle that has the correct type s et on it. This allows the 312 // *after* we've coined a File with a new handle that has the correct type s et on it. This allows the
313 // blob storage system to track when a temp file can and can't be safely del eted. 313 // blob storage system to track when a temp file can and can't be safely del eted.
314 314
315 // For regular filesystem types (temporary or persistent), we should not cac he file metadata as it could change File semantics. 315 handleEventOrScheduleCallback(m_successCallback.release(), DOMFileSystemBase ::createFile(metadata, m_url, m_fileSystem->type(), m_name));
316 // For other filesystem types (which could be platform-specific ones), there 's a chance that the files are on remote filesystem. If the port has returned me tadata just pass it to File constructor (so we may cache the metadata).
317 // FIXME: We should use the snapshot metadata for all files.
318 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746
319 if (m_fileSystem->type() == FileSystemTypeTemporary || m_fileSystem->type() == FileSystemTypePersistent) {
320 handleEventOrScheduleCallback(m_successCallback.release(), File::createF orFileSystemFile(metadata.platformPath, m_name));
321 } else if (!metadata.platformPath.isEmpty()) {
322 // If the platformPath in the returned metadata is given, we create a Fi le object for the path.
323 handleEventOrScheduleCallback(m_successCallback.release(), File::createF orFileSystemFile(m_name, metadata));
324 } else {
325 // Otherwise create a File from the FileSystem URL.
326 handleEventOrScheduleCallback(m_successCallback.release(), File::createF orFileSystemFile(m_url, metadata));
327 }
328 } 316 }
329 317
330 // VoidCallbacks -------------------------------------------------------------- 318 // VoidCallbacks --------------------------------------------------------------
331 319
332 PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(PassOwnPtrWillBeRawPt r<VoidCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCall back, ExecutionContext* context, DOMFileSystemBase* fileSystem) 320 PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(PassOwnPtrWillBeRawPt r<VoidCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCall back, ExecutionContext* context, DOMFileSystemBase* fileSystem)
333 { 321 {
334 return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, f ileSystem)); 322 return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, f ileSystem));
335 } 323 }
336 324
337 VoidCallbacks::VoidCallbacks(PassOwnPtrWillBeRawPtr<VoidCallback> successCallbac k, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCallback, ExecutionContext* contex t, DOMFileSystemBase* fileSystem) 325 VoidCallbacks::VoidCallbacks(PassOwnPtrWillBeRawPtr<VoidCallback> successCallbac k, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCallback, ExecutionContext* contex t, DOMFileSystemBase* fileSystem)
338 : FileSystemCallbacksBase(errorCallback, fileSystem, context) 326 : FileSystemCallbacksBase(errorCallback, fileSystem, context)
339 , m_successCallback(successCallback) 327 , m_successCallback(successCallback)
340 { 328 {
341 } 329 }
342 330
343 void VoidCallbacks::didSucceed() 331 void VoidCallbacks::didSucceed()
344 { 332 {
345 if (m_successCallback) 333 if (m_successCallback)
346 handleEventOrScheduleCallback(m_successCallback.release()); 334 handleEventOrScheduleCallback(m_successCallback.release());
347 } 335 }
348 336
349 } // namespace blink 337 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/filesystem/DOMFileSystemSync.cpp ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698