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

Side by Side Diff: webkit/fileapi/mount_points.h

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test on Win Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_FILEAPI_MOUNT_POINTS_H_ 5 #ifndef WEBKIT_FILEAPI_MOUNT_POINTS_H_
6 #define WEBKIT_FILEAPI_MOUNT_POINTS_H_ 6 #define WEBKIT_FILEAPI_MOUNT_POINTS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "webkit/fileapi/file_system_util.h" 13 #include "webkit/fileapi/file_system_util.h"
14 #include "webkit/storage/webkit_storage_export.h" 14 #include "webkit/storage/webkit_storage_export.h"
15 15
16 class GURL; 16 class GURL;
17 17
18 namespace fileapi { 18 namespace fileapi {
19 class FileSystemURL;
20 }
21
22 namespace fileapi {
19 23
20 // Represents a set of mount points for File API. 24 // Represents a set of mount points for File API.
21 class WEBKIT_STORAGE_EXPORT MountPoints { 25 class WEBKIT_STORAGE_EXPORT MountPoints {
22 public: 26 public:
23 struct WEBKIT_STORAGE_EXPORT MountPointInfo { 27 struct WEBKIT_STORAGE_EXPORT MountPointInfo {
24 MountPointInfo(); 28 MountPointInfo();
25 MountPointInfo(const std::string& name, const FilePath& path); 29 MountPointInfo(const std::string& name, const FilePath& path);
26 30
27 // The name to be used to register the path. The registered file can 31 // The name to be used to register the path. The registered file can
28 // be referred by a virtual path /<filesystem_id>/<name>. 32 // be referred by a virtual path /<filesystem_id>/<name>.
(...skipping 10 matching lines...) Expand all
39 }; 43 };
40 44
41 MountPoints() {} 45 MountPoints() {}
42 virtual ~MountPoints() {} 46 virtual ~MountPoints() {}
43 47
44 // Revokes a mount point identified by |mount_name|. 48 // Revokes a mount point identified by |mount_name|.
45 // Returns false if the |mount_name| is not (no longer) registered. 49 // Returns false if the |mount_name| is not (no longer) registered.
46 // TODO(kinuko): Probably this should be rather named RevokeMountPoint. 50 // TODO(kinuko): Probably this should be rather named RevokeMountPoint.
47 virtual bool RevokeFileSystem(const std::string& mount_name) = 0; 51 virtual bool RevokeFileSystem(const std::string& mount_name) = 0;
48 52
53 // Returns true if the MountPoints implementation handles filesystems with
54 // the given mount type.
55 virtual bool HandlesFileSystemMountType(FileSystemType type) const = 0;
56
57 // Same as CreateCrackedFileSystemURL, but cracks FileSystemURL created
58 // from |url|.
59 virtual FileSystemURL CrackURL(const GURL& url) const = 0;
60
61 // Creates a FileSystemURL with the given origin, type and path and tries to
62 // crack it as a part of one of the registered mount points.
63 // If the the URL is not valid or does not belong to any of the mount points
64 // registered in this context, returns empty, invalid FileSystemURL.
65 virtual FileSystemURL CreateCrackedFileSystemURL(
66 const GURL& origin,
67 fileapi::FileSystemType type,
68 const FilePath& path) const = 0;
69
49 // Returns the mount point root path registered for a given |mount_name|. 70 // Returns the mount point root path registered for a given |mount_name|.
50 // Returns false if the given |mount_name| is not valid. 71 // Returns false if the given |mount_name| is not valid.
51 virtual bool GetRegisteredPath(const std::string& mount_name, 72 virtual bool GetRegisteredPath(const std::string& mount_name,
52 FilePath* path) const = 0; 73 FilePath* path) const = 0;
53 74
54 // Cracks the given |virtual_path| (which is the path part of a filesystem URL 75 // Cracks the given |virtual_path| (which is the path part of a filesystem URL
55 // without '/external' or '/isolated' prefix part) and populates the 76 // without '/external' or '/isolated' prefix part) and populates the
56 // |mount_name|, |type|, and |path| if the <mount_name> part embedded in 77 // |mount_name|, |type|, and |path| if the <mount_name> part embedded in
57 // the |virtual_path| (i.e. the first component of the |virtual_path|) is a 78 // the |virtual_path| (i.e. the first component of the |virtual_path|) is a
58 // valid registered filesystem ID or mount name for an existing mount point. 79 // valid registered filesystem ID or mount name for an existing mount point.
59 // 80 //
60 // Returns false if the given virtual_path cannot be cracked. 81 // Returns false if the given virtual_path cannot be cracked.
61 // 82 //
62 // Note that |path| is set to empty paths if the filesystem type is isolated 83 // Note that |path| is set to empty paths if the filesystem type is isolated
63 // and |virtual_path| has no <relative_path> part (i.e. pointing to the 84 // and |virtual_path| has no <relative_path> part (i.e. pointing to the
64 // virtual root). 85 // virtual root).
65 virtual bool CrackVirtualPath(const FilePath& virtual_path, 86 virtual bool CrackVirtualPath(const FilePath& virtual_path,
66 std::string* mount_name, 87 std::string* mount_name,
67 FileSystemType* type, 88 FileSystemType* type,
68 FilePath* path) const = 0; 89 FilePath* path) const = 0;
69 90
70 private: 91 private:
71 DISALLOW_COPY_AND_ASSIGN(MountPoints); 92 DISALLOW_COPY_AND_ASSIGN(MountPoints);
72 }; 93 };
73 94
74 } // namespace fileapi 95 } // namespace fileapi
75 96
76 #endif // WEBKIT_FILEAPI_MOUNT_POINTS_H_ 97 #endif // WEBKIT_FILEAPI_MOUNT_POINTS_H_
77 98
OLDNEW
« no previous file with comments | « webkit/fileapi/media/native_media_file_util_unittest.cc ('k') | webkit/fileapi/sandbox_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698