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

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

Issue 6810037: File API changes needed for safely passing user selected file entities from the file browser comp... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 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>
9 #include <vector>
10
8 #include "base/file_path.h" 11 #include "base/file_path.h"
9 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
10 #include "webkit/fileapi/file_system_path_manager.h" 13 #include "webkit/fileapi/file_system_path_manager.h"
11 #include "webkit/fileapi/file_system_types.h" 14 #include "webkit/fileapi/file_system_types.h"
12 15
13 namespace fileapi { 16 namespace fileapi {
14 17
15 // An interface to provide local filesystem paths. 18 // An interface to provide local filesystem paths.
16 19
17 class FileSystemMountPointProvider { 20 class FileSystemMountPointProvider {
18 public: 21 public:
19 virtual ~FileSystemMountPointProvider() {} 22 virtual ~FileSystemMountPointProvider() {}
20 23
21 // Checks if mount point access is allowed from |origin_url|. 24 // Checks if access to |virtual_path| is allowed from |origin_url|.
22 virtual bool IsAccessAllowed(const GURL& origin_url) = 0; 25 virtual bool IsAccessAllowed(const GURL& origin_url,
26 const FilePath& virtual_path) = 0;
23 27
24 // Retrieves the root path for the given |origin_url| and |type|, and 28 // Retrieves the root path for the given |origin_url| and |type|, and
25 // calls the given |callback| with the root path and name. 29 // calls the given |callback| with the root path and name.
26 // If |create| is true this also creates the directory if it doesn't exist. 30 // If |create| is true this also creates the directory if it doesn't exist.
27 virtual void GetFileSystemRootPath( 31 virtual void GetFileSystemRootPath(
28 const GURL& origin_url, 32 const GURL& origin_url,
29 FileSystemType type, 33 FileSystemType type,
30 bool create, 34 bool create,
31 FileSystemPathManager::GetRootPathCallback* callback) = 0; 35 FileSystemPathManager::GetRootPathCallback* callback) = 0;
32 36
33 // Like GetFileSystemRootPath, but synchronous, and can be called only while 37 // Like GetFileSystemRootPath, but synchronous, and can be called only while
34 // running on the file thread. 38 // running on the file thread.
35 virtual FilePath GetFileSystemRootPathOnFileThread( 39 virtual FilePath GetFileSystemRootPathOnFileThread(
36 const GURL& origin_url, 40 const GURL& origin_url,
37 FileSystemType type, 41 FileSystemType type,
38 const FilePath& virtual_path, 42 const FilePath& virtual_path,
39 bool create) = 0; 43 bool create) = 0;
40 44
41 // Checks if a given |name| contains any restricted names/chars in it. 45 // Checks if a given |name| contains any restricted names/chars in it.
42 // Callable on any thread. 46 // Callable on any thread.
43 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0; 47 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0;
48
49 // Returns the list of top level directories that are exposed by this
50 // provider. This list is used to set appropriate child process file access
51 // permissions.
52 virtual std::vector<FilePath> GetRootDirectories() const = 0;
53 };
54
55 // An interface to cotnrol external file system access permissions.
56 class ExternalFileSystemMountPointProvider
57 : public FileSystemMountPointProvider {
58 public:
59 // Grant access to all external file system from extension identified with
60 // |extension_id|.
61 virtual void GrantFullAccessToExtension(const std::string& extension_id) = 0;
62 // Grants access to |virtual_path| from |origin_url|.
63 virtual void GrantFileAccessToExtension(
64 const std::string& extension_id,
65 const FilePath& virtual_path) = 0;
66 // Revoke file access from extension identified with |extension_id|.
67 virtual void RevokeAccessForExtension(
68 const std::string& extension_id) = 0;
44 }; 69 };
45 70
46 } // namespace fileapi 71 } // namespace fileapi
47 72
48 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ 73 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_
49 74
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698