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

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: wording fix 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
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', and
42 // filesystem_id() returns 'mount_name'.
43 //
20 class FILEAPI_EXPORT FileSystemURL { 44 class FILEAPI_EXPORT FileSystemURL {
21 public: 45 public:
22 FileSystemURL(); 46 FileSystemURL();
23 explicit FileSystemURL(const GURL& filesystem_url); 47 explicit FileSystemURL(const GURL& filesystem_url);
24 FileSystemURL(const GURL& origin, 48 FileSystemURL(const GURL& origin,
25 FileSystemType type, 49 FileSystemType type,
26 const FilePath& internal_path); 50 const FilePath& internal_path);
27 ~FileSystemURL(); 51 ~FileSystemURL();
28 52
53 // Returns true if this instance represents a valid FileSystem URL.
29 bool is_valid() const { return is_valid_; } 54 bool is_valid() const { return is_valid_; }
55
56 // Returns the origin part of this URL. See the class comment for details.
30 const GURL& origin() const { return origin_; } 57 const GURL& origin() const { return origin_; }
58
59 // Returns the type part of this URL. See the class comment for details.
31 FileSystemType type() const { return type_; } 60 FileSystemType type() const { return type_; }
32 61
33 // TODO(kinuko): this must be std::string. 62 // Returns the path part of this URL. See the class comment for details.
63 // TODO(kinuko): this must return std::string.
34 const FilePath& path() const { return path_; } 64 const FilePath& path() const { return path_; }
35 65
36 // For isolated filesystem. 66 // Returns the original path part of this URL.
67 // See the class comment for details.
68 // TODO(kinuko): this must return std::string.
69 const FilePath& virtual_path() const { return virtual_path_; }
70
71 // Returns the filesystem ID/name for isolated/external file system URLs.
72 // See the class comment for details.
37 const std::string& filesystem_id() const { return filesystem_id_; } 73 const std::string& filesystem_id() const { return filesystem_id_; }
38 74
39 std::string spec() const; 75 std::string spec() const;
40 76
41 // Returns a new FileSystemURL with the given path. 77 // Returns a new FileSystemURL with the given path.
42 // This doesn't change the calling instance's data. 78 // This doesn't change the calling instance's data.
43 FileSystemURL WithPath(const FilePath& path) const; 79 FileSystemURL WithPath(const FilePath& path) const;
44 80
45 bool operator==(const FileSystemURL& that) const; 81 bool operator==(const FileSystemURL& that) const;
46 82
47 private: 83 private:
48 void MayCrackIsolatedPath(); 84 void MayCrackIsolatedPath();
49 85
50 GURL origin_; 86 GURL origin_;
51 FileSystemType type_; 87 FileSystemType type_;
52 FilePath path_; 88 FilePath path_;
53 std::string filesystem_id_; // For isolated filesystem. 89
90 // For isolated filesystem.
91 std::string filesystem_id_;
92 FilePath virtual_path_;
54 93
55 bool is_valid_; 94 bool is_valid_;
56 }; 95 };
57 96
58 } // namespace fileapi 97 } // namespace fileapi
59 98
60 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_ 99 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698