OLD | NEW |
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_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_UTIL_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_UTIL_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "webkit/fileapi/file_system_types.h" | 9 #include "webkit/fileapi/file_system_types.h" |
10 #include "webkit/quota/quota_types.h" | 10 #include "webkit/quota/quota_types.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // what platform you're on. | 28 // what platform you're on. |
29 bool CrackFileSystemURL(const GURL& url, | 29 bool CrackFileSystemURL(const GURL& url, |
30 GURL* origin_url, | 30 GURL* origin_url, |
31 FileSystemType* type, | 31 FileSystemType* type, |
32 FilePath* file_path); | 32 FilePath* file_path); |
33 | 33 |
34 // Returns the root URI of the filesystem that can be specified by a pair of | 34 // Returns the root URI of the filesystem that can be specified by a pair of |
35 // |origin_url| and |type|. The returned URI can be used as a root path | 35 // |origin_url| and |type|. The returned URI can be used as a root path |
36 // of the filesystem (e.g. <returned_URI> + "/relative/path" will compose | 36 // of the filesystem (e.g. <returned_URI> + "/relative/path" will compose |
37 // a path pointing to the entry "/relative/path" in the filesystem). | 37 // a path pointing to the entry "/relative/path" in the filesystem). |
38 GURL GetFileSystemRootURI(const GURL& origin_url, fileapi::FileSystemType type); | 38 GURL GetFileSystemRootURI(const GURL& origin_url, FileSystemType type); |
| 39 |
| 40 // Returns the name for the filesystem that is specified by a pair of |
| 41 // |origin_url| and |type|. |
| 42 // (The name itself is neither really significant nor a formal identifier |
| 43 // but can be read as the .name field of the returned FileSystem object |
| 44 // as a user-friendly name in the javascript layer). |
| 45 // |
| 46 // Example: |
| 47 // The name for a TEMPORARY filesystem of "http://www.example.com:80/" |
| 48 // should look like: "http_www.example.host_80:temporary" |
| 49 std::string GetFileSystemName(const GURL& origin_url, FileSystemType type); |
39 | 50 |
40 // Converts FileSystemType |type| to/from the StorageType |storage_type| that | 51 // Converts FileSystemType |type| to/from the StorageType |storage_type| that |
41 // is used for the unified quota system. | 52 // is used for the unified quota system. |
42 // (Basically this naively maps TEMPORARY storage type to TEMPORARY filesystem | 53 // (Basically this naively maps TEMPORARY storage type to TEMPORARY filesystem |
43 // type, PERSISTENT storage type to PERSISTENT filesystem type and vice versa.) | 54 // type, PERSISTENT storage type to PERSISTENT filesystem type and vice versa.) |
44 FileSystemType QuotaStorageTypeToFileSystemType( | 55 FileSystemType QuotaStorageTypeToFileSystemType( |
45 quota::StorageType storage_type); | 56 quota::StorageType storage_type); |
46 quota::StorageType FileSystemTypeToQuotaStorageType(FileSystemType type); | 57 quota::StorageType FileSystemTypeToQuotaStorageType(FileSystemType type); |
47 | 58 |
48 // Returns the origin identifier string for the given |url| and vice versa. | 59 // Returns the origin identifier string for the given |url| and vice versa. |
49 // The origin identifier string is a serialized form of a security origin | 60 // The origin identifier string is a serialized form of a security origin |
50 // and can be used as a path name as it contains no "/" or other possibly | 61 // and can be used as a path name as it contains no "/" or other possibly |
51 // unsafe characters. (See WebKit's SecurityOrigin code for more details.) | 62 // unsafe characters. (See WebKit's SecurityOrigin code for more details.) |
52 // | 63 // |
53 // Example: | 64 // Example: |
54 // "http://www.example.com:80/"'s identifier should look like: | 65 // "http://www.example.com:80/"'s identifier should look like: |
55 // "http_www.example.host_80" | 66 // "http_www.example.host_80" |
56 std::string GetOriginIdentifierFromURL(const GURL& url); | 67 std::string GetOriginIdentifierFromURL(const GURL& url); |
57 GURL GetOriginURLFromIdentifier(const std::string& origin_identifier); | 68 GURL GetOriginURLFromIdentifier(const std::string& origin_identifier); |
58 | 69 |
59 // Returns the string representation of the given filesystem |type|. | 70 // Returns the string representation of the given filesystem |type|. |
60 // Returns an empty string if the |type| is invalid. | 71 // Returns an empty string if the |type| is invalid. |
61 std::string GetFileSystemTypeString(FileSystemType type); | 72 std::string GetFileSystemTypeString(FileSystemType type); |
62 | 73 |
63 } // namespace fileapi | 74 } // namespace fileapi |
64 | 75 |
65 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_UTIL_H_ | 76 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_UTIL_H_ |
OLD | NEW |