OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_MOUNT_POINT_PRO
VIDER_H_ | |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_MOUNT_POINT_PRO
VIDER_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | |
11 | |
12 namespace base { | |
13 class SequencedTaskRunner; | |
14 } | |
15 | |
16 namespace fileapi { | |
17 class AsyncFileUtilAdapter; | |
18 } | |
19 | |
20 namespace chrome { | |
21 | |
22 class MediaPathFilter; | |
23 | |
24 class DeviceMediaAsyncFileUtil; | |
25 | |
26 class MediaFileSystemMountPointProvider | |
27 : public fileapi::FileSystemMountPointProvider { | |
28 public: | |
29 static const char kMediaTaskRunnerName[]; | |
30 static const char kMediaPathFilterKey[]; | |
31 static const char kMTPDeviceDelegateURLKey[]; | |
32 | |
33 MediaFileSystemMountPointProvider( | |
34 const base::FilePath& profile_path, | |
35 base::SequencedTaskRunner* media_task_runner); | |
36 virtual ~MediaFileSystemMountPointProvider(); | |
37 | |
38 static bool CurrentlyOnMediaTaskRunnerThread(); | |
39 static scoped_refptr<base::SequencedTaskRunner> MediaTaskRunner(); | |
40 | |
41 // FileSystemMountPointProvider implementation. | |
42 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; | |
43 virtual void OpenFileSystem( | |
44 const GURL& origin_url, | |
45 fileapi::FileSystemType type, | |
46 fileapi::OpenFileSystemMode mode, | |
47 const OpenFileSystemCallback& callback) OVERRIDE; | |
48 virtual fileapi::FileSystemFileUtil* GetFileUtil( | |
49 fileapi::FileSystemType type) OVERRIDE; | |
50 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( | |
51 fileapi::FileSystemType type) OVERRIDE; | |
52 virtual fileapi::CopyOrMoveFileValidatorFactory* | |
53 GetCopyOrMoveFileValidatorFactory( | |
54 fileapi::FileSystemType type, | |
55 base::PlatformFileError* error_code) OVERRIDE; | |
56 virtual fileapi::FileSystemOperation* CreateFileSystemOperation( | |
57 const fileapi::FileSystemURL& url, | |
58 fileapi::FileSystemContext* context, | |
59 base::PlatformFileError* error_code) const OVERRIDE; | |
60 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | |
61 const fileapi::FileSystemURL& url, | |
62 int64 offset, | |
63 const base::Time& expected_modification_time, | |
64 fileapi::FileSystemContext* context) const OVERRIDE; | |
65 virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( | |
66 const fileapi::FileSystemURL& url, | |
67 int64 offset, | |
68 fileapi::FileSystemContext* context) const OVERRIDE; | |
69 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; | |
70 | |
71 private: | |
72 // Store the profile path. We need this to create temporary snapshot files. | |
73 const base::FilePath profile_path_; | |
74 | |
75 scoped_refptr<base::SequencedTaskRunner> media_task_runner_; | |
76 | |
77 scoped_ptr<MediaPathFilter> media_path_filter_; | |
78 scoped_ptr<fileapi::CopyOrMoveFileValidatorFactory> | |
79 media_copy_or_move_file_validator_factory_; | |
80 | |
81 scoped_ptr<fileapi::AsyncFileUtil> native_media_file_util_; | |
82 scoped_ptr<DeviceMediaAsyncFileUtil> device_media_async_file_util_; | |
83 #if defined(OS_WIN) || defined(OS_MACOSX) | |
84 scoped_ptr<fileapi::AsyncFileUtil> picasa_file_util_; | |
85 scoped_ptr<fileapi::AsyncFileUtil> itunes_file_util_; | |
86 #endif // defined(OS_WIN) || defined(OS_MACOSX) | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemMountPointProvider); | |
89 }; | |
90 | |
91 } // namespace chrome | |
92 | |
93 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_MOUNT_POINT_
PROVIDER_H_ | |
OLD | NEW |