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.
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_BACKEND_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_BACKEND_H_
11 #include "base/memory/ref_counted.h"
12 #include "content/public/browser/browser_context.h"
13 #include "webkit/browser/blob/file_stream_reader.h"
14 #include "webkit/browser/fileapi/external_mount_points.h"
15 #include "webkit/browser/fileapi/file_stream_writer.h"
16 #include "webkit/browser/fileapi/file_system_backend.h"
18 namespace local_discovery
{
20 class PrivetFileSystemAsyncUtil
;
22 class PrivetFileSystemBackend
: public fileapi::FileSystemBackend
{
24 PrivetFileSystemBackend(fileapi::ExternalMountPoints
* mount_points
,
25 content::BrowserContext
* browser_context
);
26 virtual ~PrivetFileSystemBackend();
28 // FileSystemBackend implementation.
29 virtual bool CanHandleType(fileapi::FileSystemType type
) const OVERRIDE
;
30 virtual void Initialize(fileapi::FileSystemContext
* context
) OVERRIDE
;
32 virtual void ResolveURL(const fileapi::FileSystemURL
& url
,
33 fileapi::OpenFileSystemMode mode
,
34 const OpenFileSystemCallback
& callback
) OVERRIDE
;
36 virtual fileapi::AsyncFileUtil
* GetAsyncFileUtil(
37 fileapi::FileSystemType type
) OVERRIDE
;
38 virtual fileapi::CopyOrMoveFileValidatorFactory
*
39 GetCopyOrMoveFileValidatorFactory(
40 fileapi::FileSystemType type
,
41 base::File::Error
* error_code
) OVERRIDE
;
43 virtual fileapi::FileSystemOperation
* CreateFileSystemOperation(
44 const fileapi::FileSystemURL
& url
,
45 fileapi::FileSystemContext
* context
,
46 base::File::Error
* error_code
) const OVERRIDE
;
48 virtual bool SupportsStreaming(
49 const fileapi::FileSystemURL
& url
) const OVERRIDE
;
51 virtual scoped_ptr
<webkit_blob::FileStreamReader
> CreateFileStreamReader(
52 const fileapi::FileSystemURL
& url
,
54 const base::Time
& expected_modification_time
,
55 fileapi::FileSystemContext
* context
) const OVERRIDE
;
57 virtual scoped_ptr
<fileapi::FileStreamWriter
> CreateFileStreamWriter(
58 const fileapi::FileSystemURL
& url
,
60 fileapi::FileSystemContext
* context
) const OVERRIDE
;
62 virtual fileapi::FileSystemQuotaUtil
* GetQuotaUtil() OVERRIDE
;
66 scoped_refptr
<fileapi::ExternalMountPoints
> mount_points_
;
67 scoped_ptr
<PrivetFileSystemAsyncUtil
> async_util_
;
70 } // namespace local_discovery
72 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_BACKEND_H_