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

Side by Side Diff: webkit/fileapi/file_system_url.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_types.h ('k') | webkit/fileapi/file_system_url.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FILE_SYSTEM_URL_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/platform_file.h" 11 #include "base/platform_file.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "webkit/fileapi/file_system_types.h" 13 #include "webkit/fileapi/file_system_types.h"
14 #include "webkit/fileapi/fileapi_export.h" 14 #include "webkit/fileapi/fileapi_export.h"
15 15
16 namespace fileapi { 16 namespace fileapi {
17 17
18 // A class representing a filesystem URL which consists of origin URL, 18 // A class representing a filesystem URL which consists of origin URL,
19 // type and an internal path used inside the filesystem. 19 // type and an internal path used inside the filesystem.
20 //
21 // When a FileSystemURL instance is created for regular sandbox file systems
22 // each accessor method would return following values:
23 //
24 // Example: For a URL 'filesystem:http://foo.com/temporary/foo/bar':
25 // origin() returns 'http://foo.com',
26 // type() returns kFileSystemTypeTemporary,
27 // path() and virtual_path() return 'foo/bar', and
28 // filesystem_id() returns an empty string.
29 //
30 // path() and virtual_path() usually return the same value, but they
31 // have different values if an instance is created for Isolated or External
32 // FileSystem URL, for which we may mount different paths from its exposed
33 // virtual paths.
34 //
35 // Example: Assume a path '/media/removable' is mounted at mount name
36 // 'mount_name' with type kFileSystemTypeFoo as an external file system.
37 // For a URL 'filesystem:http://bar.com/external/mount_name/foo/bar':
38 // origin() returns 'http://bar.com',
39 // type() returns the kFileSystemTypeFoo,
40 // path() returns '/media/removable/foo/bar',
41 // virtual_path() returns 'mount_name/foo/bar',
42 // filesystem_id() returns 'mount_name', and
43 // mount_type() returns kFileSystemMountTypeExternal.
44 //
20 class FILEAPI_EXPORT FileSystemURL { 45 class FILEAPI_EXPORT FileSystemURL {
21 public: 46 public:
22 FileSystemURL(); 47 FileSystemURL();
23 explicit FileSystemURL(const GURL& filesystem_url); 48 explicit FileSystemURL(const GURL& filesystem_url);
24 FileSystemURL(const GURL& origin, 49 FileSystemURL(const GURL& origin,
25 FileSystemType type, 50 FileSystemType type,
26 const FilePath& internal_path); 51 const FilePath& internal_path);
27 ~FileSystemURL(); 52 ~FileSystemURL();
28 53
54 // Returns true if this instance represents a valid FileSystem URL.
29 bool is_valid() const { return is_valid_; } 55 bool is_valid() const { return is_valid_; }
56
57 // Returns the origin part of this URL. See the class comment for details.
30 const GURL& origin() const { return origin_; } 58 const GURL& origin() const { return origin_; }
59
60 // Returns the type part of this URL. See the class comment for details.
31 FileSystemType type() const { return type_; } 61 FileSystemType type() const { return type_; }
32 62
33 // TODO(kinuko): this must be std::string. 63 // Returns the path part of this URL. See the class comment for details.
64 // TODO(kinuko): this must return std::string.
34 const FilePath& path() const { return path_; } 65 const FilePath& path() const { return path_; }
35 66
36 // For isolated filesystem. 67 // Returns the original path part of this URL.
68 // See the class comment for details.
69 // TODO(kinuko): this must return std::string.
70 const FilePath& virtual_path() const { return virtual_path_; }
71
72 // Returns the filesystem ID/name for isolated/external file system URLs.
73 // See the class comment for details.
37 const std::string& filesystem_id() const { return filesystem_id_; } 74 const std::string& filesystem_id() const { return filesystem_id_; }
38 75
76 // Returns the mount type of this URL for isolated/external file system URLs.
77 FileSystemMountType mount_type() const { return mount_type_; }
78
39 std::string spec() const; 79 std::string spec() const;
40 80
41 // Returns a new FileSystemURL with the given path. 81 // Returns a new FileSystemURL with the given path.
42 // This doesn't change the calling instance's data. 82 // This doesn't change the calling instance's data.
43 FileSystemURL WithPath(const FilePath& path) const; 83 FileSystemURL WithPath(const FilePath& path) const;
44 84
45 bool operator==(const FileSystemURL& that) const; 85 bool operator==(const FileSystemURL& that) const;
46 86
47 private: 87 private:
48 void MayCrackIsolatedPath(); 88 void MayCrackIsolatedPath();
49 89
50 GURL origin_; 90 GURL origin_;
51 FileSystemType type_; 91 FileSystemType type_;
52 FilePath path_; 92 FilePath path_;
53 std::string filesystem_id_; // For isolated filesystem. 93
94 // For isolated filesystem.
95 std::string filesystem_id_;
96 FilePath virtual_path_;
97 FileSystemMountType mount_type_;
54 98
55 bool is_valid_; 99 bool is_valid_;
56 }; 100 };
57 101
58 } // namespace fileapi 102 } // namespace fileapi
59 103
60 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_ 104 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_types.h ('k') | webkit/fileapi/file_system_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698