diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 20:37:59 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 20:37:59 +0000 |
commit | 55d9bed8de248d583bd5770a42c8520e1225162b (patch) | |
tree | 6be27d9ee263e9a475385120a933bcb29fe75a74 /webkit/chromeos/fileapi/cros_mount_point_provider.h | |
parent | e69b903ec57dc0f511598b03d4aae148a56e33bc (diff) | |
download | chromium_src-55d9bed8de248d583bd5770a42c8520e1225162b.zip chromium_src-55d9bed8de248d583bd5770a42c8520e1225162b.tar.gz chromium_src-55d9bed8de248d583bd5770a42c8520e1225162b.tar.bz2 |
Wired local file system support for File API. The local file system provider currently exists for ChromeOS builds only.
This CL exposes new extension permission 'fileSystem' that controls access to individual local file system elements from 3rd party extensions. Another new permission 'fileBrowserPrivate' controls access to following API call that retrieves root DOMFileSystem instance for locally exposed folders:
chrome.fileBrowserPrivate.requestLocalFileSystem(callback)
BUG=chromium-os:11983
TEST=ExtensionApiTest.LocalFileSystem
Review URL: http://codereview.chromium.org/6519040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/chromeos/fileapi/cros_mount_point_provider.h')
-rw-r--r-- | webkit/chromeos/fileapi/cros_mount_point_provider.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.h b/webkit/chromeos/fileapi/cros_mount_point_provider.h new file mode 100644 index 0000000..5ac8f37 --- /dev/null +++ b/webkit/chromeos/fileapi/cros_mount_point_provider.h @@ -0,0 +1,59 @@ + // Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ +#define WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ + +#include <map> +#include <set> +#include <string> + +#include "webkit/fileapi/file_system_mount_point_provider.h" +#include "webkit/quota/special_storage_policy.h" + +namespace chromeos { + +// An interface to provide local filesystem paths. +class CrosMountPointProvider + : public fileapi::FileSystemMountPointProvider { + public: + CrosMountPointProvider( + scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); + virtual ~CrosMountPointProvider(); + + // fileapi::FileSystemMountPointProvider overrides. + virtual bool IsAccessAllowed(const GURL& origin_url) OVERRIDE; + + virtual void GetFileSystemRootPath( + const GURL& origin_url, + fileapi::FileSystemType type, + bool create, + fileapi::FileSystemPathManager::GetRootPathCallback* callback) OVERRIDE; + + virtual FilePath GetFileSystemRootPathOnFileThread( + const GURL& origin_url, + fileapi::FileSystemType type, + const FilePath& virtual_path, + bool create); + + virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; + + private: + class GetFileSystemRootPathTask; + typedef std::map<std::string, std::string> MountPointMap; + + static const char kLocalDirName[]; + static const char kLocalName[]; + FilePath virtual_root_path_; + FilePath base_path_; + std::string local_dir_name_; + MountPointMap mount_point_map_; + scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; + + DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); +}; + +} // namespace chromeos + +#endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |