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_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | |
9 | 10 |
10 #include "base/file_path.h" | 11 #include "base/file_path.h" |
11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
12 #include "webkit/fileapi/file_system_mount_point_provider.h" | 13 #include "webkit/fileapi/file_system_mount_point_provider.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class MessageLoopProxy; | 18 class MessageLoopProxy; |
18 } | 19 } |
19 | 20 |
20 namespace fileapi { | 21 namespace fileapi { |
21 | 22 |
22 class SandboxMountPointProvider : public FileSystemMountPointProvider { | 23 class SandboxMountPointProvider : public FileSystemMountPointProvider { |
23 public: | 24 public: |
24 | 25 |
25 SandboxMountPointProvider( | 26 SandboxMountPointProvider( |
26 FileSystemPathManager* path_manager, | 27 FileSystemPathManager* path_manager, |
27 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 28 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
28 const FilePath& profile_path); | 29 const FilePath& profile_path); |
29 virtual ~SandboxMountPointProvider(); | 30 virtual ~SandboxMountPointProvider(); |
30 | 31 |
31 // Checks if mount point access is allowed from |origin_url|. | 32 // Checks if access to |virtual_path| is allowed from |origin_url|. |
32 virtual bool IsAccessAllowed(const GURL& origin_url); | 33 virtual bool IsAccessAllowed(const GURL& origin_url, |
34 const FilePath& virtual_path); | |
35 virtual void GrantAccess(const GURL& origin_url, | |
36 const FilePath& virtual_path) {} | |
ericu
2011/04/07 01:40:58
Should this ever get called? How about a NOTREACH
zel
2011/04/07 02:54:42
Done.
| |
33 | 37 |
34 // Retrieves the root path for the given |origin_url| and |type|, and | 38 // Retrieves the root path for the given |origin_url| and |type|, and |
35 // calls the given |callback| with the root path and name. | 39 // calls the given |callback| with the root path and name. |
36 // If |create| is true this also creates the directory if it doesn't exist. | 40 // If |create| is true this also creates the directory if it doesn't exist. |
37 virtual void GetFileSystemRootPath( | 41 virtual void GetFileSystemRootPath( |
38 const GURL& origin_url, | 42 const GURL& origin_url, |
39 FileSystemType type, | 43 FileSystemType type, |
40 bool create, | 44 bool create, |
41 FileSystemPathManager::GetRootPathCallback* callback); | 45 FileSystemPathManager::GetRootPathCallback* callback); |
42 | 46 |
(...skipping 11 matching lines...) Expand all Loading... | |
54 static const char kPersistentName[]; | 58 static const char kPersistentName[]; |
55 static const char kTemporaryName[]; | 59 static const char kTemporaryName[]; |
56 | 60 |
57 const FilePath& base_path() const { | 61 const FilePath& base_path() const { |
58 return base_path_; | 62 return base_path_; |
59 } | 63 } |
60 | 64 |
61 // Checks if a given |name| contains any restricted names/chars in it. | 65 // Checks if a given |name| contains any restricted names/chars in it. |
62 virtual bool IsRestrictedFileName(const FilePath& filename) const; | 66 virtual bool IsRestrictedFileName(const FilePath& filename) const; |
63 | 67 |
68 virtual std::vector<FilePath> GetRootDirectories() const { | |
69 return std::vector<FilePath>(); | |
ericu
2011/04/07 01:40:58
Same here. Perhaps these shouldn't really live on
zel
2011/04/07 02:54:42
I've added NOTREACHED() here. Done.
| |
70 } | |
71 | |
64 // Returns the origin identifier string, which is used as a part of the | 72 // Returns the origin identifier string, which is used as a part of the |
65 // sandboxed path component, for the given |url|. | 73 // sandboxed path component, for the given |url|. |
66 static std::string GetOriginIdentifierFromURL(const GURL& url); | 74 static std::string GetOriginIdentifierFromURL(const GURL& url); |
67 | 75 |
68 // Gets a base directory path of the sandboxed filesystem that is | 76 // Gets a base directory path of the sandboxed filesystem that is |
69 // specified by |origin_identifier| and |type|. | 77 // specified by |origin_identifier| and |type|. |
70 // |base_path| must be pointing the FileSystem's data directory | 78 // |base_path| must be pointing the FileSystem's data directory |
71 // under the profile directory, i.e. <profile_dir>/kFileSystemDirectory. | 79 // under the profile directory, i.e. <profile_dir>/kFileSystemDirectory. |
72 // Returns an empty path if any of the given parameters are invalid. | 80 // Returns an empty path if any of the given parameters are invalid. |
73 // Returned directory path does not contain 'unique' part, therefore | 81 // Returned directory path does not contain 'unique' part, therefore |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 121 |
114 const FilePath base_path_; | 122 const FilePath base_path_; |
115 | 123 |
116 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); | 124 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); |
117 }; | 125 }; |
118 | 126 |
119 } // namespace fileapi | 127 } // namespace fileapi |
120 | 128 |
121 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 129 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
122 | 130 |
OLD | NEW |