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 storage::FileSystemBackend
{
24 PrivetFileSystemBackend(storage::ExternalMountPoints
* mount_points
,
25 content::BrowserContext
* browser_context
);
26 virtual ~PrivetFileSystemBackend();
28 // FileSystemBackend implementation.
29 virtual bool CanHandleType(storage::FileSystemType type
) const OVERRIDE
;
30 virtual void Initialize(storage::FileSystemContext
* context
) OVERRIDE
;
32 virtual void ResolveURL(const storage::FileSystemURL
& url
,
33 storage::OpenFileSystemMode mode
,
34 const OpenFileSystemCallback
& callback
) OVERRIDE
;
36 virtual storage::AsyncFileUtil
* GetAsyncFileUtil(
37 storage::FileSystemType type
) OVERRIDE
;
38 virtual storage::CopyOrMoveFileValidatorFactory
*
39 GetCopyOrMoveFileValidatorFactory(storage::FileSystemType type
,
40 base::File::Error
* error_code
) OVERRIDE
;
42 virtual storage::FileSystemOperation
* CreateFileSystemOperation(
43 const storage::FileSystemURL
& url
,
44 storage::FileSystemContext
* context
,
45 base::File::Error
* error_code
) const OVERRIDE
;
47 virtual bool SupportsStreaming(
48 const storage::FileSystemURL
& url
) const OVERRIDE
;
50 virtual bool HasInplaceCopyImplementation(
51 storage::FileSystemType type
) const OVERRIDE
;
53 virtual scoped_ptr
<storage::FileStreamReader
> CreateFileStreamReader(
54 const storage::FileSystemURL
& url
,
56 const base::Time
& expected_modification_time
,
57 storage::FileSystemContext
* context
) const OVERRIDE
;
59 virtual scoped_ptr
<storage::FileStreamWriter
> CreateFileStreamWriter(
60 const storage::FileSystemURL
& url
,
62 storage::FileSystemContext
* context
) const OVERRIDE
;
64 virtual storage::FileSystemQuotaUtil
* GetQuotaUtil() OVERRIDE
;
68 scoped_refptr
<storage::ExternalMountPoints
> mount_points_
;
69 scoped_ptr
<PrivetFileSystemAsyncUtil
> async_util_
;
72 } // namespace local_discovery
74 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_BACKEND_H_