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

Unified Diff: webkit/chromeos/fileapi/cros_mount_point_provider.h

Issue 10823273: Integrate external mount points to IsolatedContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove too strict DCHECK Created 8 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 side-by-side diff with in-line comments
Download patch
Index: webkit/chromeos/fileapi/cros_mount_point_provider.h
diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.h b/webkit/chromeos/fileapi/cros_mount_point_provider.h
index a7c410bf469fe6fcdf97bca4189e0209f60e28c6..a9e06505c8c1f42d5e33c8ac7c65dbd84571a3aa 100644
--- a/webkit/chromeos/fileapi/cros_mount_point_provider.h
+++ b/webkit/chromeos/fileapi/cros_mount_point_provider.h
@@ -11,13 +11,16 @@
#include "base/compiler_specific.h"
#include "base/file_path.h"
+#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "webkit/fileapi/file_system_mount_point_provider.h"
-#include "webkit/fileapi/local_file_util.h"
+#include "webkit/fileapi/fileapi_export.h"
#include "webkit/quota/special_storage_policy.h"
namespace fileapi {
class FileSystemFileUtil;
+class IsolatedContext;
+class LocalFileUtil;
}
namespace chromeos {
@@ -25,24 +28,21 @@ namespace chromeos {
class FileAccessPermissions;
// An interface to provide local filesystem paths.
-class CrosMountPointProvider
+class FILEAPI_EXPORT CrosMountPointProvider
: public fileapi::ExternalFileSystemMountPointProvider {
public:
using fileapi::FileSystemMountPointProvider::ValidateFileSystemCallback;
using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback;
- // Mount point file system location enum.
- enum FileSystemLocation {
- // File system that is locally mounted by the underlying OS.
- LOCAL,
- // File system that is remotely hosted on the net.
- REMOTE,
- };
-
CrosMountPointProvider(
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy);
virtual ~CrosMountPointProvider();
+ // Returns true if CrosMountpointProvider can handle |url|, i.e. its
+ // file system type matches with what this provider supports.
+ // This could be called on any threads.
+ static bool CanHandleURL(const fileapi::FileSystemURL& url);
+
// fileapi::FileSystemMountPointProvider overrides.
virtual void ValidateFileSystemRoot(
const GURL& origin_url,
@@ -99,39 +99,19 @@ class CrosMountPointProvider
FilePath* virtual_path) OVERRIDE;
private:
- // Representation of a mount point exposed by this external mount point
- // provider.
- struct MountPoint {
- MountPoint(const FilePath& web_path,
- const FilePath& local_path,
- FileSystemLocation loc,
- fileapi::RemoteFileSystemProxyInterface* proxy);
- virtual ~MountPoint();
- // Virtual web path, relative to external root in filesystem URLs.
- // For example, in "filesystem://.../external/foo/bar/" this path would
- // map to "foo/bar/".
- const FilePath web_root_path;
- // Parent directory for the exposed file system path. For example,
- // mount point that exposes "/media/removable" would have this
- // root path as "/media".
- const FilePath local_root_path;
- // File system location.
- const FileSystemLocation location;
- // Remote file system proxy for remote mount points.
- scoped_refptr<fileapi::RemoteFileSystemProxyInterface> remote_proxy;
- };
-
- typedef std::map<std::string, MountPoint> MountPointMap;
-
- // Gives the real file system's |root_path| for given |virtual_path|. Returns
- // false when |virtual_path| cannot be mapped to the real file system.
- bool GetRootForVirtualPath(const FilePath& virtual_path, FilePath* root_path);
- // Returns mount point info for a given |virtual_path|, NULL if the path is
- // not part of the mounted file systems exposed through this provider.
- const MountPoint* GetMountPoint(const FilePath& virtual_path) const;
-
- base::Lock mount_point_map_lock_;
- MountPointMap mount_point_map_;
+ typedef scoped_refptr<fileapi::RemoteFileSystemProxyInterface> RemoteProxy;
+ typedef std::map<FilePath::StringType, RemoteProxy> RemoteProxyMap;
+
+ fileapi::IsolatedContext* isolated_context() const;
+
+ // Represents a map from mount point name to a remote proxy.
+ RemoteProxyMap remote_proxy_map_;
+
+ // Reverse map for GetVirtualPath.
+ std::map<FilePath, FilePath> local_to_virtual_map_;
+
+ mutable base::Lock mount_point_map_lock_;
+
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
scoped_ptr<FileAccessPermissions> file_access_permissions_;
scoped_ptr<fileapi::LocalFileUtil> local_file_util_;
« no previous file with comments | « content/browser/fileapi/fileapi_message_filter.cc ('k') | webkit/chromeos/fileapi/cros_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698