OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | |
tzik
2011/12/21 02:52:33
can be #include "base/callback_forward.h"?
kinuko
2011/12/21 13:00:50
Done.
| |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "googleurl/src/gurl.h" | |
13 #include "webkit/fileapi/file_system_path_manager.h" | |
14 #include "webkit/fileapi/file_system_types.h" | 13 #include "webkit/fileapi/file_system_types.h" |
15 | 14 |
15 class GURL; | |
16 | |
16 namespace fileapi { | 17 namespace fileapi { |
17 | 18 |
19 class FileSystemFileUtil; | |
20 | |
18 // An interface to provide mount-point-specific path-related utilities | 21 // An interface to provide mount-point-specific path-related utilities |
19 // and specialized FileSystemFileUtil instance. | 22 // and specialized FileSystemFileUtil instance. |
20 class FileSystemMountPointProvider { | 23 class FileSystemMountPointProvider { |
21 public: | 24 public: |
25 // Callback for GetFileSystemRootPath. | |
26 // If the request is accepted and the root filesystem for the origin exists | |
27 // the callback is called with success=true and valid root_path and name. | |
28 // If the request is accepted, |create| is specified for | |
29 // GetFileSystemRootPath, and the root directory does not exist, it creates | |
30 // a new one and calls back with success=true if the creation has succeeded. | |
31 typedef base::Callback<void(bool /* success */, | |
32 const FilePath& /* root_path */, | |
33 const std::string& /* name */)> | |
34 GetRootPathCallback; | |
22 virtual ~FileSystemMountPointProvider() {} | 35 virtual ~FileSystemMountPointProvider() {} |
23 | 36 |
24 // Checks if access to |virtual_path| is allowed from |origin_url|. | 37 // Checks if access to |virtual_path| is allowed from |origin_url|. |
25 virtual bool IsAccessAllowed(const GURL& origin_url, | 38 virtual bool IsAccessAllowed(const GURL& origin_url, |
26 FileSystemType type, | 39 FileSystemType type, |
27 const FilePath& virtual_path) = 0; | 40 const FilePath& virtual_path) = 0; |
28 | 41 |
29 // Retrieves the root path for the given |origin_url| and |type|, and | 42 // Retrieves the root path for the given |origin_url| and |type|, and |
30 // calls the given |callback| with the root path and name. | 43 // calls the given |callback| with the root path and name. |
31 // If |create| is true this also creates the directory if it doesn't exist. | 44 // If |create| is true this also creates the directory if it doesn't exist. |
32 virtual void ValidateFileSystemRootAndGetURL( | 45 virtual void ValidateFileSystemRootAndGetURL( |
33 const GURL& origin_url, | 46 const GURL& origin_url, |
34 FileSystemType type, | 47 FileSystemType type, |
35 bool create, | 48 bool create, |
36 const FileSystemPathManager::GetRootPathCallback& callback) = 0; | 49 const GetRootPathCallback& callback) = 0; |
37 | 50 |
38 // Like GetFileSystemRootPath, but synchronous, and can be called only while | 51 // Like GetFileSystemRootPath, but synchronous, and can be called only while |
39 // running on the file thread. | 52 // running on the file thread. |
40 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread( | 53 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread( |
41 const GURL& origin_url, | 54 const GURL& origin_url, |
42 FileSystemType type, | 55 FileSystemType type, |
43 const FilePath& virtual_path, | 56 const FilePath& virtual_path, |
44 bool create) = 0; | 57 bool create) = 0; |
45 | 58 |
46 // Checks if a given |name| contains any restricted names/chars in it. | 59 // Checks if a given |name| contains any restricted names/chars in it. |
(...skipping 29 matching lines...) Expand all Loading... | |
76 virtual void RemoveMountPoint(FilePath mount_point) = 0; | 89 virtual void RemoveMountPoint(FilePath mount_point) = 0; |
77 // Gets virtual path by known filesystem path. Returns false when filesystem | 90 // Gets virtual path by known filesystem path. Returns false when filesystem |
78 // path is not exposed by this provider. | 91 // path is not exposed by this provider. |
79 virtual bool GetVirtualPath(const FilePath& filesystem_path, | 92 virtual bool GetVirtualPath(const FilePath& filesystem_path, |
80 FilePath* virtual_path) = 0; | 93 FilePath* virtual_path) = 0; |
81 }; | 94 }; |
82 | 95 |
83 } // namespace fileapi | 96 } // namespace fileapi |
84 | 97 |
85 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 98 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |