summaryrefslogtreecommitdiffstats
path: root/webkit/browser/fileapi/sandbox_file_system_backend.cc
Commit message (Collapse)AuthorAgeFilesLines
* Create file systems restricted to volumes. mtomasz@chromium.org2014-02-261-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, on Chrome OS, JS Entry objects were holding the same DOMFileSystem object, and they were attached to the same big root. All of the mount points were first-level directories. This looks like a Linux approach. However, for better isolation a different approach has been suggested. To have a separate DOMFileSystem object per every volume on Chrome OS. So, Downloads and Drive files would be separate, and the filesystem's root would be one of the mount points. What is more, restricting DOMFileSystem objects to a mount point is not enough. In case of `archive` and `removable`, we have two level mount points. The first level is either `archive` or `removable`. Either of them contains mounted volumes - archives or removable devices. This patch restricts DOMFileSystem objects (and thereof Entry objects) to the inner most mount point. For example: /Downloads, /drive, /archive/archive-1, /archive/archive-2, /removable/disk-1, /removable/disk-2. Having this solution it is impossible to access the grand root containing all of the outer mount points, which was until now restricted in JavaScript. Also, it doesn't allow to get an Entry for /archive and /removable, which was also filtered out in JS layer. Moreover, and what is the most important, this approach allows to map a C++ VolumeInfo to a DOMFileSystem object with 1:1 relationship. To achieve that, the OpenFileSystem has been renamed to ResolveURL, since this method has been always used to Resolving a file system URL. Opening the file system was a side effect. This allowed to unify the code paths for sandboxed and non-sandboxed file systems. Before, for non-sandboxed file systems, the root url (and the name) were manually computed using a deprecated utility function fileapi::GetFileSystemInfoForChromeOS(), which is removed in this patch. The drawback of this change was that the root_url and the fs name resolution became asynchonous. The reason for that is that sandboxed file systems may perform operations on different threads, therefore they have to be asynchronous. To simplify migration a utility function has been introduced to convert FileDefinition vectors to EntryDefinition vectors. Finally, this change will allow simplifying Files app volumes logic significantly. The JS VolumeInfo will match C++ VolumeInfo 1:1, as well as either VolumeInfo will match a DOMFileSystem object 1:1. As a result, we will be able to remove special cases for inner mount points (for archives and removables). Another advantage is simple way to pass names of JS-provided file systems. The permission management is currently simplified, but the next step will be to grant permissions per inner-most mount point, which will clean up security policy comparing to the former implementation. TBR=phajdan.jr@chromium.org BUG=318021 TEST=Tested manually. Review URL: https://codereview.chromium.org/162963003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253351 0039d316-1c4b-4281-b951-d872f2087c98
* Fileapi: Add alternate code path to cleanly support streaming backends.tommycli@chromium.org2014-02-241-0/+5
| | | | | | | | | | | This adds the fileapi infrastructure changes kinuko recommended in the comments to: https://codereview.chromium.org/107833003/ TBR=sky BUG=110119 Review URL: https://codereview.chromium.org/165943010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252946 0039d316-1c4b-4281-b951-d872f2087c98
* Convert Media Galleries to use base::Filervargas@chromium.org2014-01-271-4/+4
| | | | | | | | | | | | | | | Unfortunately, this brings in changes to webkit/browser/fileapi, and once that changes, a lot of files have to be updated. The bright side is that most of the collateral changes are just trivial renaming of PlatformFileError -> File::Error and PlatformFileInfo -> File::Info BUG=322664 Review URL: https://codereview.chromium.org/145303002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247301 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI dependency cleanup: stop referencing quota_observer in ↵kinuko@chromium.org2013-10-181-8/+2
| | | | | | | | | | | | | | | | SyncFileSystemBackend - Add RegisterQuotaUpdateObserver() method to remove sandbox_quota_observer dependency in SyncFileSystemBackend. - Also move IsAccessValid() and IsAllowedScheme() to private in SandboxFileSystemBackendDelegate. BUG=265770 R=tzik@chromium.org Review URL: https://codereview.chromium.org/26906007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229273 0039d316-1c4b-4281-b951-d872f2087c98
* Instead introducing a static Create* methods to create ↵kinuko@chromium.org2013-09-121-2/+2
| | | | | | | | | | | | | | | | | | | | | FileStream{Reader,Writer} implementation that are defined in webkit/. New public static Create methods: - FileStreamReader::CreateForLocalFile() - FileStreamReader::CreateForFileSystemFile() - FileStreamWriter::CreateForLocalFile() As a preparation for moving fileapi code from webkit/ to content/. (webkit_blob / fileapi namespaces will be cleaned up when they're moved under content/) BUG=265770 Review URL: https://chromiumcodereview.appspot.com/23576016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222802 0039d316-1c4b-4281-b951-d872f2087c98
* Remove dependency to file_system_operation_impl.h outside from chrome/kinuko@chromium.org2013-09-091-2/+2
| | | | | | | | | | | | | | | | Instead introducing a static FileSystemOperation::Create method. As a preparation for moving fileapi code from webkit/ to content/. (file_system_operation.h will be placed under content/public/browser/ while file_system_operation_impl.{h,cc} will be placed under content/browser/fileapi and will be hidden from chrome/) BUG=265770 TEST=existing tests Review URL: https://chromiumcodereview.appspot.com/23835005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221976 0039d316-1c4b-4281-b951-d872f2087c98
* Deprecate FileSystemBackend::GetFileUtil()kinuko@chromium.org2013-08-301-5/+0
| | | | | | | | | BUG=272715 TEST=existing tests Review URL: https://chromiumcodereview.appspot.com/23601005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220444 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Implement FileSystemQuotaUtil on SandboxFileSystemBackendDelegatenhiroki@chromium.org2013-08-221-118/+23
| | | | | | | | | | | | | | | | | This makes SandboxFileSystemBackendDelegate to implement FileSystemQuotaUtil instead of Sandbox/SyncFileSystemBackend so that it can remove a thin layer from those backends. And also moves common implementations of FileSystemBackend (e.g. CreateFileStreamReader()) into the delegate. BUG=272078 TEST=unit_tests, content_unittests Review URL: https://chromiumcodereview.appspot.com/22821006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218987 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Rename SandboxContext to SandboxFileSystemBackendDelegatenhiroki@chromium.org2013-08-151-30/+30
| | | | | | | | | | BUG=272078 TEST=n/a (renaming only) TBR=jochen Review URL: https://chromiumcodereview.appspot.com/23167002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217752 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Remove unnecessary interfaces from FileSystemQuotaUtilnhiroki@chromium.org2013-08-141-16/+0
| | | | | | | | | | | | | | | | | This removes unnecessary interfaces (InvalidateUsageCache and StickyInvalidateUsageCache) from FileSystemQuotaUtil. Current implementation calls usage-cache related functions of SandboxContext via Sandbox/SyncFileSystembackend, but actually it's possible to call them directly. BUG=272078 TEST=pass all existing tests (no behavioral change) Review URL: https://chromiumcodereview.appspot.com/22818004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217495 0039d316-1c4b-4281-b951-d872f2087c98
* Deprecate FileSystemTaskRunnerskinuko@chromium.org2013-08-041-1/+0
| | | | | | | | | | | | | Now it only has two members, IO and default file task runner, and only file runner accessor is used. BUG=266232 TEST=compile R=satorux@chromium.org, tzik@chromium.org, vandebo@chromium.org Review URL: https://codereview.chromium.org/20989003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215538 0039d316-1c4b-4281-b951-d872f2087c98
* SyncFS: Introduce SyncFileSystemBackendnhiroki@chromium.org2013-08-021-41/+3
| | | | | | | | | | | | | This change introduces SyncaFileSystemBackend to remove SyncFS dependencies from FileSystemContext and SandboxFileSystemBackend. BUG=242422 TEST=content_unittests R=kinuko@chromium.org, tzik@chromium.org Review URL: https://codereview.chromium.org/18668003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215222 0039d316-1c4b-4281-b951-d872f2087c98
* Rename fileapi::LocalFileSystemOperation to FileSystemOperationImpl.hidehiko@chromium.org2013-08-011-2/+3
| | | | | | | | | | | | | Drive File System starts to use LocalFileSystemOperation, so it is no longer "local". As it is the default implementation of FileSystemOperation, this CL renames it to FileSystemOperationImpl BUG=261477 TEST=Ran unit_tests Review URL: https://chromiumcodereview.appspot.com/21370003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215033 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Move OpenFileSystem into SandboxContextnhiroki@chromium.org2013-08-011-105/+5
| | | | | | | | | | | | | | This moves SandboxFileSystemBackend::OpenFileSystem to SandboxContext so that the backend can share the function with SyncFileSystemBackend which will be introduced in the following CL. BUG=242422 TEST=content_unittests R=kinuko@chromium.org, tzik@chromium.org Review URL: https://codereview.chromium.org/21305005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214991 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Move FileSystemQuotaUtil related functions into SandboxContextnhiroki@chromium.org2013-08-011-242/+35
| | | | | | | | | | | | | | | | | | | | | This moves FileSystemQuotaUtil related functions from SandboxFileSystemBackend to SandboxContext so that SyncFileSystemBackend which will be introduced in the following CL can use the same code. This does not include any behavioral changes of those functions. This is a preparation patch to introduce SyncFileSystemBackend https://codereview.chromium.org/18668003/ BUG=242422 TEST=content_unittests NOTRY=true TBR=jochen@chromium.org Review URL: https://chromiumcodereview.appspot.com/21116008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214977 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Remove unnecessary usage recalculation from SandboxFSBackendnhiroki@chromium.org2013-07-311-32/+5
| | | | | | | | | | | | | | | | When open a filesystem, quota usage recalculation is scheduled so that the quota manager can correctly track file operations done without usage tracking, but those operations have gone away. This change removes the scheduling parts and related parts. BUG=none TEST=should pass all existing tests R=kinuko@chromium.org, tzik@chromium.org Review URL: https://codereview.chromium.org/20147004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214565 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Remove UMAs for OpenFileSystem operationnhiroki@chromium.org2013-07-311-17/+1
| | | | | | | | | | BUG=none TEST=none (no behavioral changes) R=kinuko@chromium.org, tzik@chromium.org Review URL: https://codereview.chromium.org/20303002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214544 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Clean up around FileSystemBackendnhiroki@chromium.org2013-07-251-3/+3
| | | | | | | | | | | | | Outdated comments and variable names still remain around FileSystemBackend. This change cleans them up. BUG=241701 TEST=none R=kinuko@chromium.org Review URL: https://codereview.chromium.org/20277003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213616 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Add Initialize() function to FileSystemBackendnhiroki@chromium.org2013-07-241-13/+15
| | | | | | | | | | | | | | | | | | | | This is a preliminary change for adding SyncFileSystemBackend. At first, we planed to do initializing process for SyncFileSystemBackend in InitializeFileSystem(), but it revealed that there are some hassles on that way (see [*]), so we decieded to introduce a separate initialze function and to rename InitializeFileSystem() to its original name (i.e. OpenFileSystem()). [*] https://codereview.chromium.org/18668003/ BUG=242422 TEST=should pass all existing tests NOTRY=true Review URL: https://chromiumcodereview.appspot.com/19632004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213382 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Move enable_usage_tracking into SandboxContext for cleanupnhiroki@chromium.org2013-07-231-10/+3
| | | | | | | | | | BUG=242422 TEST=should pass all exising tests (no behavioral changes) NOTRY=true Review URL: https://chromiumcodereview.appspot.com/19616007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213070 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Change FileSystemBackend::OpenFileSystem signaturenhiroki@chromium.org2013-07-171-2/+3
| | | | | | | | | | | | | | | | | This change renames FileSystemBackend::OpenFileSystem to InitializeFileSystem and makes it accept FileSystemContext object as one of its arguments. This is a preliminary change for adding SyncFileSystemBackend in the following change sets. Please see the issue for details. BUG=242422 TEST=should pass all existing tests NOTRY=true Review URL: https://chromiumcodereview.appspot.com/19092002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211888 0039d316-1c4b-4281-b951-d872f2087c98
* Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual ↵brettw@chromium.org2013-07-151-1/+1
| | | | | | | | | | to the base namespace. TBR=sky Review URL: https://codereview.chromium.org/19052005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211675 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: add const AddObserver method to TaskRunnerBoundObserverListkinuko@chromium.org2013-07-121-19/+9
| | | | | | | | | | | | | To deprecate TaskRunnerBoundObserverList::Source, which tends to add more code just to ensure constness of the observer list. BUG=241701 TEST=no behavioral changes (content_unittests:*File*) NOTRY=true Review URL: https://chromiumcodereview.appspot.com/18943006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211356 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Add FileObserver related interfaces into FileSystemQuotaUtilnhiroki@chromium.org2013-07-121-39/+59
| | | | | | | | | | | | | | | | | | This change adds FileObserver related interfaces into FileSystemQuotaUtil and adapts existing functions in SandboxFileSystemBackend and TestFileSystemBackend to them. These functions are used only in sandbox filesystem and we are moving all of those kinds of functions to FileSystemQuotaUtil so that other backends don't have to take care of them. BUG=242422 TEST=content_unittests R=kinuko@chromium.org, tzik@chromium.org Review URL: https://codereview.chromium.org/18418009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211332 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Factor out getting root URI and FS name parts into each FS backendnhiroki@chromium.org2013-07-121-5/+15
| | | | | | | | | | | | | | We plan to introduce SyncFileSystemBackend to remove SyncFS related code from webkit/browser/fileapi. To do that, this change moves getting root URI and filesystem name parts from FileSystemContext to each FileSystemBackend. BUG=242422 TEST=content_unittests R=kinuko@chromium.org, satorux@chromium.org, tzik@chromium.org Review URL: https://codereview.chromium.org/18300006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211318 0039d316-1c4b-4281-b951-d872f2087c98
* FileAPI: Add SandboxContextnhiroki@chromium.org2013-07-101-66/+36
| | | | | | | | | | | | | This change introduces SandboxContext class which keeps and provides a sandbox filesystem context so that we can share the context among multiple FS backends. BUG=242422 TEST=content_unittests Review URL: https://chromiumcodereview.appspot.com/18378005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210790 0039d316-1c4b-4281-b951-d872f2087c98
* fileapi: Rename FileSystemMountProvider to FileSystemBackendsatorux@chromium.org2013-07-091-0/+676
The old name is a misnomer as this class no longer provides mount points! Per some discussion, FileSystemBackend matches what the class is currently doing and trying to be. BUG=257016 TEST=none TBR=hidehiko@chromium.org, joi@chromium.org, kinuko@chromium.org, vandebo@chromium.org # for one-line #include renames in chrome/browser/browsing_data/browsing_data_file_system_helper.cc chrome/browser/extensions/component_loader.cc chrome/browser/extensions/extension_service.cc Review URL: https://codereview.chromium.org/18344013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210480 0039d316-1c4b-4281-b951-d872f2087c98