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

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

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « webkit/fileapi/media/native_media_file_util_unittest.cc ('k') | webkit/fileapi/mount_points.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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; 19 class FileSystemURL;
20 } 20 }
21 21
22 namespace fileapi { 22 namespace fileapi {
23 23
24 // Represents a set of mount points for File API. 24 // Represents a set of mount points for File API.
25 class WEBKIT_STORAGE_EXPORT MountPoints { 25 class WEBKIT_STORAGE_EXPORT MountPoints {
26 public: 26 public:
27 struct WEBKIT_STORAGE_EXPORT MountPointInfo { 27 struct WEBKIT_STORAGE_EXPORT MountPointInfo {
28 MountPointInfo(); 28 MountPointInfo();
29 MountPointInfo(const std::string& name, const FilePath& path); 29 MountPointInfo(const std::string& name, const base::FilePath& path);
30 30
31 // 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
32 // be referred by a virtual path /<filesystem_id>/<name>. 32 // be referred by a virtual path /<filesystem_id>/<name>.
33 // The name should NOT contain a path separator '/'. 33 // The name should NOT contain a path separator '/'.
34 std::string name; 34 std::string name;
35 35
36 // The path of the file. 36 // The path of the file.
37 FilePath path; 37 base::FilePath path;
38 38
39 // For STL operation. 39 // For STL operation.
40 bool operator<(const MountPointInfo& that) const { 40 bool operator<(const MountPointInfo& that) const {
41 return name < that.name; 41 return name < that.name;
42 } 42 }
43 }; 43 };
44 44
45 MountPoints() {} 45 MountPoints() {}
46 virtual ~MountPoints() {} 46 virtual ~MountPoints() {}
47 47
(...skipping 10 matching lines...) Expand all
58 // from |url|. 58 // from |url|.
59 virtual FileSystemURL CrackURL(const GURL& url) const = 0; 59 virtual FileSystemURL CrackURL(const GURL& url) const = 0;
60 60
61 // Creates a FileSystemURL with the given origin, type and path and tries to 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. 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 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. 64 // registered in this context, returns empty, invalid FileSystemURL.
65 virtual FileSystemURL CreateCrackedFileSystemURL( 65 virtual FileSystemURL CreateCrackedFileSystemURL(
66 const GURL& origin, 66 const GURL& origin,
67 fileapi::FileSystemType type, 67 fileapi::FileSystemType type,
68 const FilePath& path) const = 0; 68 const base::FilePath& path) const = 0;
69 69
70 // 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|.
71 // Returns false if the given |mount_name| is not valid. 71 // Returns false if the given |mount_name| is not valid.
72 virtual bool GetRegisteredPath(const std::string& mount_name, 72 virtual bool GetRegisteredPath(const std::string& mount_name,
73 FilePath* path) const = 0; 73 base::FilePath* path) const = 0;
74 74
75 // 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
76 // without '/external' or '/isolated' prefix part) and populates the 76 // without '/external' or '/isolated' prefix part) and populates the
77 // |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
78 // 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
79 // 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.
80 // 80 //
81 // Returns false if the given virtual_path cannot be cracked. 81 // Returns false if the given virtual_path cannot be cracked.
82 // 82 //
83 // 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
84 // 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
85 // virtual root). 85 // virtual root).
86 virtual bool CrackVirtualPath(const FilePath& virtual_path, 86 virtual bool CrackVirtualPath(const base::FilePath& virtual_path,
87 std::string* mount_name, 87 std::string* mount_name,
88 FileSystemType* type, 88 FileSystemType* type,
89 FilePath* path) const = 0; 89 base::FilePath* path) const = 0;
90 90
91 private: 91 private:
92 DISALLOW_COPY_AND_ASSIGN(MountPoints); 92 DISALLOW_COPY_AND_ASSIGN(MountPoints);
93 }; 93 };
94 94
95 } // namespace fileapi 95 } // namespace fileapi
96 96
97 #endif // WEBKIT_FILEAPI_MOUNT_POINTS_H_ 97 #endif // WEBKIT_FILEAPI_MOUNT_POINTS_H_
98 98
OLDNEW
« no previous file with comments | « webkit/fileapi/media/native_media_file_util_unittest.cc ('k') | webkit/fileapi/mount_points.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698