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

Side by Side Diff: webkit/fileapi/sandbox_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_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);
michaeln 2011/04/09 00:16:45 is there a use case for revoking access?
zel 2011/04/13 00:44:26 Not right now. All extension permissions are revok
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
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
64 // Returns the origin identifier string, which is used as a part of the 70 // Returns the origin identifier string, which is used as a part of the
65 // sandboxed path component, for the given |url|. 71 // sandboxed path component, for the given |url|.
66 static std::string GetOriginIdentifierFromURL(const GURL& url); 72 static std::string GetOriginIdentifierFromURL(const GURL& url);
67 73
68 // Gets a base directory path of the sandboxed filesystem that is 74 // Gets a base directory path of the sandboxed filesystem that is
69 // specified by |origin_identifier| and |type|. 75 // specified by |origin_identifier| and |type|.
70 // |base_path| must be pointing the FileSystem's data directory 76 // |base_path| must be pointing the FileSystem's data directory
71 // under the profile directory, i.e. <profile_dir>/kFileSystemDirectory. 77 // under the profile directory, i.e. <profile_dir>/kFileSystemDirectory.
72 // Returns an empty path if any of the given parameters are invalid. 78 // Returns an empty path if any of the given parameters are invalid.
73 // Returned directory path does not contain 'unique' part, therefore 79 // Returned directory path does not contain 'unique' part, therefore
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 119
114 const FilePath base_path_; 120 const FilePath base_path_;
115 121
116 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); 122 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider);
117 }; 123 };
118 124
119 } // namespace fileapi 125 } // namespace fileapi
120 126
121 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ 127 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_
122 128
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698