NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / media_galleries / fileapi / media_file_system_backend.h
blob92e50792cea66e862756f71e50425ab60c89d2d6
1 // Copyright (c) 2013 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_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "webkit/browser/fileapi/file_system_backend.h"
12 namespace base {
13 class SequencedTaskRunner;
16 class MediaPathFilter;
18 class DeviceMediaAsyncFileUtil;
20 class MediaFileSystemBackend : public fileapi::FileSystemBackend {
21 public:
22 static const char kMediaTaskRunnerName[];
24 MediaFileSystemBackend(
25 const base::FilePath& profile_path,
26 base::SequencedTaskRunner* media_task_runner);
27 virtual ~MediaFileSystemBackend();
29 static bool CurrentlyOnMediaTaskRunnerThread();
30 static scoped_refptr<base::SequencedTaskRunner> MediaTaskRunner();
32 // FileSystemBackend implementation.
33 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE;
34 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE;
35 virtual void OpenFileSystem(
36 const GURL& origin_url,
37 fileapi::FileSystemType type,
38 fileapi::OpenFileSystemMode mode,
39 const OpenFileSystemCallback& callback) OVERRIDE;
40 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil(
41 fileapi::FileSystemType type) OVERRIDE;
42 virtual fileapi::CopyOrMoveFileValidatorFactory*
43 GetCopyOrMoveFileValidatorFactory(
44 fileapi::FileSystemType type,
45 base::File::Error* error_code) OVERRIDE;
46 virtual fileapi::FileSystemOperation* CreateFileSystemOperation(
47 const fileapi::FileSystemURL& url,
48 fileapi::FileSystemContext* context,
49 base::File::Error* error_code) const OVERRIDE;
50 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
51 const fileapi::FileSystemURL& url,
52 int64 offset,
53 const base::Time& expected_modification_time,
54 fileapi::FileSystemContext* context) const OVERRIDE;
55 virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter(
56 const fileapi::FileSystemURL& url,
57 int64 offset,
58 fileapi::FileSystemContext* context) const OVERRIDE;
59 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
61 private:
62 // Store the profile path. We need this to create temporary snapshot files.
63 const base::FilePath profile_path_;
65 scoped_refptr<base::SequencedTaskRunner> media_task_runner_;
67 scoped_ptr<MediaPathFilter> media_path_filter_;
68 scoped_ptr<fileapi::CopyOrMoveFileValidatorFactory>
69 media_copy_or_move_file_validator_factory_;
71 scoped_ptr<fileapi::AsyncFileUtil> native_media_file_util_;
72 scoped_ptr<DeviceMediaAsyncFileUtil> device_media_async_file_util_;
73 #if defined(OS_WIN) || defined(OS_MACOSX)
74 scoped_ptr<fileapi::AsyncFileUtil> picasa_file_util_;
75 scoped_ptr<fileapi::AsyncFileUtil> itunes_file_util_;
76 #endif // defined(OS_WIN) || defined(OS_MACOSX)
77 #if defined(OS_MACOSX)
78 scoped_ptr<fileapi::AsyncFileUtil> iphoto_file_util_;
79 #endif // defined(OS_MACOSX)
81 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemBackend);
84 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_