Experimental push messaging api reference docs.
[chromium-blink-merge.git] / webkit / fileapi / test_mount_point_provider.h
blob7d52e48c413f7043605ebd4c5ab2c248361e483a
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 WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
6 #define WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
8 #include "base/file_path.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "webkit/fileapi/file_system_mount_point_provider.h"
12 #include "webkit/fileapi/fileapi_export.h"
13 #include "webkit/fileapi/task_runner_bound_observer_list.h"
15 namespace base {
16 class SequencedTaskRunner;
19 namespace fileapi {
21 class LocalFileUtil;
22 class FileSystemQuotaUtil;
24 // This should be only used for testing.
25 // This mount point provider uses LocalFileUtil and stores data file
26 // under the given directory.
27 class FILEAPI_EXPORT_PRIVATE TestMountPointProvider
28 : public FileSystemMountPointProvider {
29 public:
30 using FileSystemMountPointProvider::ValidateFileSystemCallback;
31 using FileSystemMountPointProvider::DeleteFileSystemCallback;
33 TestMountPointProvider(
34 base::SequencedTaskRunner* task_runner,
35 const FilePath& base_path);
36 virtual ~TestMountPointProvider();
38 // FileSystemMountPointProvider implementation.
39 virtual void ValidateFileSystemRoot(
40 const GURL& origin_url,
41 FileSystemType type,
42 bool create,
43 const ValidateFileSystemCallback& callback) OVERRIDE;
44 virtual FilePath GetFileSystemRootPathOnFileThread(
45 const GURL& origin_url,
46 FileSystemType type,
47 const FilePath& virtual_path,
48 bool create) OVERRIDE;
49 virtual bool IsAccessAllowed(const FileSystemURL& url) OVERRIDE;
50 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
51 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
52 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path)
53 const OVERRIDE;
54 virtual FileSystemOperation* CreateFileSystemOperation(
55 const FileSystemURL& url,
56 FileSystemContext* context,
57 base::PlatformFileError* error_code) const OVERRIDE;
58 virtual webkit_blob::FileStreamReader* CreateFileStreamReader(
59 const FileSystemURL& url,
60 int64 offset,
61 FileSystemContext* context) const OVERRIDE;
62 virtual FileStreamWriter* CreateFileStreamWriter(
63 const FileSystemURL& url,
64 int64 offset,
65 FileSystemContext* context) const OVERRIDE;
66 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
67 virtual void DeleteFileSystem(
68 const GURL& origin_url,
69 FileSystemType type,
70 FileSystemContext* context,
71 const DeleteFileSystemCallback& callback) OVERRIDE;
73 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const;
75 private:
76 class QuotaUtil;
78 FilePath base_path_;
79 scoped_refptr<base::SequencedTaskRunner> task_runner_;
80 scoped_ptr<LocalFileUtil> local_file_util_;
81 scoped_ptr<QuotaUtil> quota_util_;
82 UpdateObserverList observers_;
85 } // namespace fileapi
87 #endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_