| 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_SANDBOXED_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ |
| 6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ |
| 7 | 7 |
| 8 #include "base/scoped_callback_factory.h" | 8 #include "base/scoped_callback_factory.h" |
| 9 #include "webkit/fileapi/file_system_operation.h" | 9 #include "webkit/fileapi/file_system_operation.h" |
| 10 #include "webkit/fileapi/file_system_types.h" | 10 #include "webkit/fileapi/file_system_types.h" |
| 11 | 11 |
| 12 namespace fileapi { | 12 namespace fileapi { |
| 13 | 13 |
| 14 class ObfuscatedFileUtilProxy; |
| 14 class SandboxedFileSystemContext; | 15 class SandboxedFileSystemContext; |
| 15 | 16 |
| 16 // This class provides a 'sandboxed' access to the underlying file system, | 17 // This class provides a 'sandboxed' access to the underlying file system, |
| 17 // that is: | 18 // that is: |
| 18 // 1. provides OpenFileSystem method that returns a (hidden) root path | 19 // 1. provides OpenFileSystem method that returns a (hidden) root path |
| 19 // that is given by |file_system_context|. | 20 // that is given by |file_system_context|. |
| 20 // 2. enforces quota and file names/paths restrictions on each operation | 21 // 2. enforces quota and file names/paths restrictions on each operation |
| 21 // via |file_system_context|. | 22 // via |file_system_context|. |
| 22 class SandboxedFileSystemOperation : public FileSystemOperation { | 23 class SandboxedFileSystemOperation : public FileSystemOperation { |
| 23 public: | 24 public: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 virtual void ReadDirectory(const FilePath& path); | 48 virtual void ReadDirectory(const FilePath& path); |
| 48 virtual void Remove(const FilePath& path, bool recursive); | 49 virtual void Remove(const FilePath& path, bool recursive); |
| 49 virtual void Write( | 50 virtual void Write( |
| 50 scoped_refptr<net::URLRequestContext> url_request_context, | 51 scoped_refptr<net::URLRequestContext> url_request_context, |
| 51 const FilePath& path, const GURL& blob_url, int64 offset); | 52 const FilePath& path, const GURL& blob_url, int64 offset); |
| 52 virtual void Truncate(const FilePath& path, int64 length); | 53 virtual void Truncate(const FilePath& path, int64 length); |
| 53 virtual void TouchFile(const FilePath& path, | 54 virtual void TouchFile(const FilePath& path, |
| 54 const base::Time& last_access_time, | 55 const base::Time& last_access_time, |
| 55 const base::Time& last_modified_time); | 56 const base::Time& last_modified_time); |
| 56 | 57 |
| 58 protected: |
| 59 virtual base::FileUtilProxyBase* file_util_proxy() const; |
| 60 |
| 57 private: | 61 private: |
| 58 enum SandboxedFileSystemOperationType { | 62 enum SandboxedFileSystemOperationType { |
| 59 kOperationOpenFileSystem = 100, | 63 kOperationOpenFileSystem = 100, |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 // A callback used for OpenFileSystem. | 66 // A callback used for OpenFileSystem. |
| 63 void DidGetRootPath(bool success, | 67 void DidGetRootPath(bool success, |
| 64 const FilePath& path, | 68 const FilePath& path, |
| 65 const std::string& name); | 69 const std::string& name); |
| 66 | 70 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 93 scoped_refptr<SandboxedFileSystemContext> file_system_context_; | 97 scoped_refptr<SandboxedFileSystemContext> file_system_context_; |
| 94 | 98 |
| 95 base::ScopedCallbackFactory<SandboxedFileSystemOperation> callback_factory_; | 99 base::ScopedCallbackFactory<SandboxedFileSystemOperation> callback_factory_; |
| 96 | 100 |
| 97 DISALLOW_COPY_AND_ASSIGN(SandboxedFileSystemOperation); | 101 DISALLOW_COPY_AND_ASSIGN(SandboxedFileSystemOperation); |
| 98 }; | 102 }; |
| 99 | 103 |
| 100 } // namespace fileapi | 104 } // namespace fileapi |
| 101 | 105 |
| 102 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ | 106 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |