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

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

Issue 10879002: kFileSystemTypeIsolated should be only used in the URL exposed to renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 years, 3 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 // 20 //
21 // When a FileSystemURL instance is created for regular sandbox file systems 21 // When a FileSystemURL instance is created for regular sandbox file systems
22 // each accessor method would return following values: 22 // each accessor method would return following values:
23 // 23 //
24 // Example: For a URL 'filesystem:http://foo.com/temporary/foo/bar': 24 // Example: For a URL 'filesystem:http://foo.com/temporary/foo/bar':
25 // origin() returns 'http://foo.com', 25 // origin() returns 'http://foo.com',
26 // type() returns kFileSystemTypeTemporary, 26 // type() and mount_type() return kFileSystemTypeTemporary,
27 // path() and virtual_path() return 'foo/bar', and 27 // path() and virtual_path() return 'foo/bar', and
28 // filesystem_id() returns an empty string. 28 // filesystem_id() returns an empty string.
29 // 29 //
30 // path() and virtual_path() usually return the same value, but they 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 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 32 // FileSystem URL, for which we may mount different paths from its exposed
33 // virtual paths. 33 // virtual paths.
34 // 34 //
35 // Example: Assume a path '/media/removable' is mounted at mount name 35 // Example: Assume a path '/media/removable' is mounted at mount name
36 // 'mount_name' with type kFileSystemTypeFoo as an external file system. 36 // 'mount_name' with type kFileSystemTypeFoo as an external file system.
37 // For a URL 'filesystem:http://bar.com/external/mount_name/foo/bar': 37 // For a URL 'filesystem:http://bar.com/external/mount_name/foo/bar':
38 // origin() returns 'http://bar.com', 38 // origin() returns 'http://bar.com',
39 // type() returns the kFileSystemTypeFoo, 39 // type() returns the kFileSystemTypeFoo,
40 // path() returns '/media/removable/foo/bar', 40 // path() returns '/media/removable/foo/bar',
41 // virtual_path() returns 'mount_name/foo/bar', 41 // virtual_path() returns 'mount_name/foo/bar',
42 // filesystem_id() returns 'mount_name', and 42 // filesystem_id() returns 'mount_name', and
43 // mount_type() returns kFileSystemMountTypeExternal. 43 // mount_type() returns kFileSystemTypeExternal.
44 // 44 //
45 class FILEAPI_EXPORT FileSystemURL { 45 class FILEAPI_EXPORT FileSystemURL {
46 public: 46 public:
47 FileSystemURL(); 47 FileSystemURL();
48 explicit FileSystemURL(const GURL& filesystem_url); 48 explicit FileSystemURL(const GURL& filesystem_url);
49 FileSystemURL(const GURL& origin, 49 FileSystemURL(const GURL& origin,
50 FileSystemType type, 50 FileSystemType type,
51 const FilePath& internal_path); 51 const FilePath& internal_path);
52 ~FileSystemURL(); 52 ~FileSystemURL();
53 53
(...skipping 12 matching lines...) Expand all
66 66
67 // Returns the original path part of this URL. 67 // Returns the original path part of this URL.
68 // See the class comment for details. 68 // See the class comment for details.
69 // TODO(kinuko): this must return std::string. 69 // TODO(kinuko): this must return std::string.
70 const FilePath& virtual_path() const { return virtual_path_; } 70 const FilePath& virtual_path() const { return virtual_path_; }
71 71
72 // Returns the filesystem ID/name for isolated/external file system URLs. 72 // Returns the filesystem ID/name for isolated/external file system URLs.
73 // See the class comment for details. 73 // See the class comment for details.
74 const std::string& filesystem_id() const { return filesystem_id_; } 74 const std::string& filesystem_id() const { return filesystem_id_; }
75 75
76 // Returns the mount type of this URL for isolated/external file system URLs. 76 // Returns the public file system type of this URL.
77 FileSystemMountType mount_type() const { return mount_type_; } 77 // See the class comment for details.
78 FileSystemType mount_type() const { return mount_type_; }
78 79
79 std::string spec() const; 80 std::string spec() const;
80 81
81 // Returns a new FileSystemURL with the given path. 82 // Returns a new FileSystemURL with the given path.
82 // This doesn't change the calling instance's data. 83 // This doesn't change the calling instance's data.
83 FileSystemURL WithPath(const FilePath& path) const; 84 FileSystemURL WithPath(const FilePath& path) const;
84 85
85 bool operator==(const FileSystemURL& that) const; 86 bool operator==(const FileSystemURL& that) const;
86 87
87 private: 88 private:
88 void MayCrackIsolatedPath(); 89 void MayCrackIsolatedPath();
89 90
90 GURL origin_; 91 GURL origin_;
91 FileSystemType type_; 92 FileSystemType type_;
92 FilePath path_; 93 FilePath path_;
93 94
94 // For isolated filesystem. 95 // For isolated filesystem.
95 std::string filesystem_id_; 96 std::string filesystem_id_;
96 FilePath virtual_path_; 97 FilePath virtual_path_;
97 FileSystemMountType mount_type_; 98 FileSystemType mount_type_;
98 99
99 bool is_valid_; 100 bool is_valid_;
100 }; 101 };
101 102
102 } // namespace fileapi 103 } // namespace fileapi
103 104
104 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_H_ 105 #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