Include all dupe types (event when value is zero) in scan stats.
[chromium-blink-merge.git] / storage / browser / fileapi / sandbox_file_system_backend.h
blobe187f9bae23d9d5a4dd574353f4c31594c57c32f
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.
5 #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
8 #include <set>
9 #include <string>
11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "storage/browser/fileapi/file_system_backend.h"
16 #include "storage/browser/fileapi/file_system_quota_util.h"
17 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
18 #include "storage/browser/fileapi/task_runner_bound_observer_list.h"
19 #include "storage/browser/quota/special_storage_policy.h"
20 #include "storage/browser/storage_browser_export.h"
22 namespace storage {
24 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's
25 // profile directory in a sandboxed way.
26 // This interface also lets one enumerate and remove storage for the origins
27 // that use the filesystem.
28 class STORAGE_EXPORT SandboxFileSystemBackend
29 : public FileSystemBackend {
30 public:
31 explicit SandboxFileSystemBackend(SandboxFileSystemBackendDelegate* delegate);
32 ~SandboxFileSystemBackend() override;
34 // FileSystemBackend overrides.
35 bool CanHandleType(FileSystemType type) const override;
36 void Initialize(FileSystemContext* context) override;
37 void ResolveURL(const FileSystemURL& url,
38 OpenFileSystemMode mode,
39 const OpenFileSystemCallback& callback) override;
40 AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) override;
41 WatcherManager* GetWatcherManager(FileSystemType type) override;
42 CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
43 FileSystemType type,
44 base::File::Error* error_code) override;
45 FileSystemOperation* CreateFileSystemOperation(
46 const FileSystemURL& url,
47 FileSystemContext* context,
48 base::File::Error* error_code) const override;
49 bool SupportsStreaming(const FileSystemURL& url) const override;
50 bool HasInplaceCopyImplementation(
51 storage::FileSystemType type) const override;
52 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
53 const FileSystemURL& url,
54 int64 offset,
55 int64 max_bytes_to_read,
56 const base::Time& expected_modification_time,
57 FileSystemContext* context) const override;
58 scoped_ptr<FileStreamWriter> CreateFileStreamWriter(
59 const FileSystemURL& url,
60 int64 offset,
61 FileSystemContext* context) const override;
62 FileSystemQuotaUtil* GetQuotaUtil() override;
63 const UpdateObserverList* GetUpdateObservers(
64 FileSystemType type) const override;
65 const ChangeObserverList* GetChangeObservers(
66 FileSystemType type) const override;
67 const AccessObserverList* GetAccessObservers(
68 FileSystemType type) const override;
70 // Returns an origin enumerator of this backend.
71 // This method can only be called on the file thread.
72 SandboxFileSystemBackendDelegate::OriginEnumerator* CreateOriginEnumerator();
74 void set_enable_temporary_file_system_in_incognito(bool enable) {
75 enable_temporary_file_system_in_incognito_ = enable;
77 bool enable_temporary_file_system_in_incognito() const {
78 return enable_temporary_file_system_in_incognito_;
82 private:
83 SandboxFileSystemBackendDelegate* delegate_; // Not owned.
85 bool enable_temporary_file_system_in_incognito_;
87 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackend);
90 } // namespace storage
92 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_