1// Copyright (c) 2012 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 STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_
6#define STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_
7
8#include "base/memory/scoped_ptr.h"
9#include "storage/browser/fileapi/file_system_backend.h"
10#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
11
12namespace storage {
13
14class AsyncFileUtilAdapter;
15
16class IsolatedFileSystemBackend : public FileSystemBackend {
17 public:
18  IsolatedFileSystemBackend();
19  virtual ~IsolatedFileSystemBackend();
20
21  // FileSystemBackend implementation.
22  virtual bool CanHandleType(FileSystemType type) const OVERRIDE;
23  virtual void Initialize(FileSystemContext* context) OVERRIDE;
24  virtual void ResolveURL(const FileSystemURL& url,
25                          OpenFileSystemMode mode,
26                          const OpenFileSystemCallback& callback) OVERRIDE;
27  virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
28  virtual WatcherManager* GetWatcherManager(FileSystemType type) OVERRIDE;
29  virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
30      FileSystemType type,
31      base::File::Error* error_code) OVERRIDE;
32  virtual FileSystemOperation* CreateFileSystemOperation(
33      const FileSystemURL& url,
34      FileSystemContext* context,
35      base::File::Error* error_code) const OVERRIDE;
36  virtual bool SupportsStreaming(const FileSystemURL& url) const OVERRIDE;
37  virtual bool HasInplaceCopyImplementation(
38      storage::FileSystemType type) const OVERRIDE;
39  virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
40      const FileSystemURL& url,
41      int64 offset,
42      int64 max_bytes_to_read,
43      const base::Time& expected_modification_time,
44      FileSystemContext* context) const OVERRIDE;
45  virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter(
46      const FileSystemURL& url,
47      int64 offset,
48      FileSystemContext* context) const OVERRIDE;
49  virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
50  virtual const UpdateObserverList* GetUpdateObservers(
51      FileSystemType type) const OVERRIDE;
52  virtual const ChangeObserverList* GetChangeObservers(
53      FileSystemType type) const OVERRIDE;
54  virtual const AccessObserverList* GetAccessObservers(
55      FileSystemType type) const OVERRIDE;
56
57 private:
58  scoped_ptr<AsyncFileUtilAdapter> isolated_file_util_;
59  scoped_ptr<AsyncFileUtilAdapter> dragged_file_util_;
60  scoped_ptr<AsyncFileUtilAdapter> transient_file_util_;
61};
62
63}  // namespace storage
64
65#endif  // STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_
66