Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_BACKEND_H_ | |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_BACKEND_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "webkit/browser/blob/file_stream_reader.h" | |
| 13 #include "webkit/browser/fileapi/external_mount_points.h" | |
| 14 #include "webkit/browser/fileapi/file_stream_writer.h" | |
| 15 #include "webkit/browser/fileapi/file_system_backend.h" | |
| 16 | |
| 17 namespace local_discovery { | |
| 18 | |
| 19 class PrivetFileSystemAsyncUtil; | |
| 20 | |
| 21 class PrivetFileSystemBackend : public fileapi::ExternalFileSystemBackend { | |
| 22 public: | |
| 23 explicit PrivetFileSystemBackend(fileapi::ExternalMountPoints* mount_points); | |
| 24 virtual ~PrivetFileSystemBackend(); | |
| 25 | |
| 26 // FileSystemBackend implementation. | |
| 27 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; | |
| 28 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE; | |
| 29 | |
| 30 virtual void OpenFileSystem( | |
| 31 const GURL& origin_url, | |
| 32 fileapi::FileSystemType type, | |
| 33 fileapi::OpenFileSystemMode mode, | |
| 34 const OpenFileSystemCallback& callback) OVERRIDE; | |
| 35 | |
| 36 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( | |
| 37 fileapi::FileSystemType type) OVERRIDE; | |
| 38 virtual fileapi::CopyOrMoveFileValidatorFactory* | |
| 39 GetCopyOrMoveFileValidatorFactory( | |
| 40 fileapi::FileSystemType type, | |
| 41 base::PlatformFileError* error_code) OVERRIDE; | |
| 42 | |
| 43 virtual fileapi::FileSystemOperation* CreateFileSystemOperation( | |
| 44 const fileapi::FileSystemURL& url, | |
| 45 fileapi::FileSystemContext* context, | |
| 46 base::PlatformFileError* error_code) const OVERRIDE; | |
| 47 | |
| 48 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | |
| 49 const fileapi::FileSystemURL& url, | |
| 50 int64 offset, | |
| 51 const base::Time& expected_modification_time, | |
| 52 fileapi::FileSystemContext* context) const OVERRIDE; | |
| 53 | |
| 54 virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( | |
| 55 const fileapi::FileSystemURL& url, | |
| 56 int64 offset, | |
| 57 fileapi::FileSystemContext* context) const OVERRIDE; | |
| 58 | |
| 59 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; | |
| 60 | |
| 61 // ExternalFileSystemBackend implementation. | |
|
kinuko
2014/01/09 04:27:41
It's a bit sad to have more filesystems that depen
Noam Samuel
2014/01/09 18:59:15
Hm, on second look this might not be needed. When
| |
| 62 virtual bool IsAccessAllowed( | |
| 63 const fileapi::FileSystemURL& url) const OVERRIDE; | |
| 64 virtual std::vector<base::FilePath> GetRootDirectories() const OVERRIDE; | |
| 65 virtual void GrantFullAccessToExtension( | |
| 66 const std::string& extension_id) OVERRIDE; | |
| 67 virtual void GrantFileAccessToExtension( | |
| 68 const std::string& extension_id, | |
| 69 const base::FilePath& virtual_path) OVERRIDE; | |
| 70 virtual void RevokeAccessForExtension( | |
| 71 const std::string& extension_id) OVERRIDE; | |
| 72 virtual bool GetVirtualPath(const base::FilePath& file_system_path, | |
| 73 base::FilePath* virtual_path) OVERRIDE; | |
| 74 | |
| 75 private: | |
| 76 // User mount points. | |
| 77 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; | |
| 78 scoped_ptr<PrivetFileSystemAsyncUtil> async_util_; | |
| 79 }; | |
| 80 | |
| 81 } // namespace local_discovery | |
| 82 | |
| 83 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_BACKEND_H_ | |
| OLD | NEW |