OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 class MediaPathFilter; | 30 class MediaPathFilter; |
31 class DeviceMediaAsyncFileUtil; | 31 class DeviceMediaAsyncFileUtil; |
32 | 32 |
33 class MediaFileSystemBackend : public storage::FileSystemBackend { | 33 class MediaFileSystemBackend : public storage::FileSystemBackend { |
34 public: | 34 public: |
35 static const char kMediaTaskRunnerName[]; | 35 static const char kMediaTaskRunnerName[]; |
36 | 36 |
37 MediaFileSystemBackend( | 37 MediaFileSystemBackend( |
38 const base::FilePath& profile_path, | 38 const base::FilePath& profile_path, |
39 base::SequencedTaskRunner* media_task_runner); | 39 base::SequencedTaskRunner* media_task_runner); |
40 virtual ~MediaFileSystemBackend(); | 40 ~MediaFileSystemBackend() override; |
41 | 41 |
42 static bool CurrentlyOnMediaTaskRunnerThread(); | 42 static bool CurrentlyOnMediaTaskRunnerThread(); |
43 static scoped_refptr<base::SequencedTaskRunner> MediaTaskRunner(); | 43 static scoped_refptr<base::SequencedTaskRunner> MediaTaskRunner(); |
44 | 44 |
45 // Construct the mount point for the gallery specified by |pref_id| in | 45 // Construct the mount point for the gallery specified by |pref_id| in |
46 // the profile located in |profile_path|. | 46 // the profile located in |profile_path|. |
47 static std::string ConstructMountName(const base::FilePath& profile_path, | 47 static std::string ConstructMountName(const base::FilePath& profile_path, |
48 const std::string& extension_id, | 48 const std::string& extension_id, |
49 MediaGalleryPrefId pref_id); | 49 MediaGalleryPrefId pref_id); |
50 | 50 |
51 static bool AttemptAutoMountForURLRequest( | 51 static bool AttemptAutoMountForURLRequest( |
52 const net::URLRequest* url_request, | 52 const net::URLRequest* url_request, |
53 const storage::FileSystemURL& filesystem_url, | 53 const storage::FileSystemURL& filesystem_url, |
54 const std::string& storage_domain, | 54 const std::string& storage_domain, |
55 const base::Callback<void(base::File::Error result)>& callback); | 55 const base::Callback<void(base::File::Error result)>& callback); |
56 | 56 |
57 // FileSystemBackend implementation. | 57 // FileSystemBackend implementation. |
58 virtual bool CanHandleType(storage::FileSystemType type) const override; | 58 bool CanHandleType(storage::FileSystemType type) const override; |
59 virtual void Initialize(storage::FileSystemContext* context) override; | 59 void Initialize(storage::FileSystemContext* context) override; |
60 virtual void ResolveURL(const storage::FileSystemURL& url, | 60 void ResolveURL(const storage::FileSystemURL& url, |
61 storage::OpenFileSystemMode mode, | 61 storage::OpenFileSystemMode mode, |
62 const OpenFileSystemCallback& callback) override; | 62 const OpenFileSystemCallback& callback) override; |
63 virtual storage::AsyncFileUtil* GetAsyncFileUtil( | 63 storage::AsyncFileUtil* GetAsyncFileUtil( |
64 storage::FileSystemType type) override; | 64 storage::FileSystemType type) override; |
65 virtual storage::WatcherManager* GetWatcherManager( | 65 storage::WatcherManager* GetWatcherManager( |
66 storage::FileSystemType type) override; | 66 storage::FileSystemType type) override; |
67 virtual storage::CopyOrMoveFileValidatorFactory* | 67 storage::CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
68 GetCopyOrMoveFileValidatorFactory(storage::FileSystemType type, | 68 storage::FileSystemType type, |
69 base::File::Error* error_code) override; | 69 base::File::Error* error_code) override; |
70 virtual storage::FileSystemOperation* CreateFileSystemOperation( | 70 storage::FileSystemOperation* CreateFileSystemOperation( |
71 const storage::FileSystemURL& url, | 71 const storage::FileSystemURL& url, |
72 storage::FileSystemContext* context, | 72 storage::FileSystemContext* context, |
73 base::File::Error* error_code) const override; | 73 base::File::Error* error_code) const override; |
74 virtual bool SupportsStreaming( | 74 bool SupportsStreaming(const storage::FileSystemURL& url) const override; |
75 const storage::FileSystemURL& url) const override; | 75 bool HasInplaceCopyImplementation( |
76 virtual bool HasInplaceCopyImplementation( | |
77 storage::FileSystemType type) const override; | 76 storage::FileSystemType type) const override; |
78 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( | 77 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
79 const storage::FileSystemURL& url, | 78 const storage::FileSystemURL& url, |
80 int64 offset, | 79 int64 offset, |
81 int64 max_bytes_to_read, | 80 int64 max_bytes_to_read, |
82 const base::Time& expected_modification_time, | 81 const base::Time& expected_modification_time, |
83 storage::FileSystemContext* context) const override; | 82 storage::FileSystemContext* context) const override; |
84 virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( | 83 scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( |
85 const storage::FileSystemURL& url, | 84 const storage::FileSystemURL& url, |
86 int64 offset, | 85 int64 offset, |
87 storage::FileSystemContext* context) const override; | 86 storage::FileSystemContext* context) const override; |
88 virtual storage::FileSystemQuotaUtil* GetQuotaUtil() override; | 87 storage::FileSystemQuotaUtil* GetQuotaUtil() override; |
89 virtual const storage::UpdateObserverList* GetUpdateObservers( | 88 const storage::UpdateObserverList* GetUpdateObservers( |
90 storage::FileSystemType type) const override; | 89 storage::FileSystemType type) const override; |
91 virtual const storage::ChangeObserverList* GetChangeObservers( | 90 const storage::ChangeObserverList* GetChangeObservers( |
92 storage::FileSystemType type) const override; | 91 storage::FileSystemType type) const override; |
93 virtual const storage::AccessObserverList* GetAccessObservers( | 92 const storage::AccessObserverList* GetAccessObservers( |
94 storage::FileSystemType type) const override; | 93 storage::FileSystemType type) const override; |
95 | 94 |
96 private: | 95 private: |
97 // Store the profile path. We need this to create temporary snapshot files. | 96 // Store the profile path. We need this to create temporary snapshot files. |
98 const base::FilePath profile_path_; | 97 const base::FilePath profile_path_; |
99 | 98 |
100 scoped_refptr<base::SequencedTaskRunner> media_task_runner_; | 99 scoped_refptr<base::SequencedTaskRunner> media_task_runner_; |
101 | 100 |
102 scoped_ptr<MediaPathFilter> media_path_filter_; | 101 scoped_ptr<MediaPathFilter> media_path_filter_; |
103 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> | 102 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> |
104 media_copy_or_move_file_validator_factory_; | 103 media_copy_or_move_file_validator_factory_; |
105 | 104 |
106 scoped_ptr<storage::AsyncFileUtil> native_media_file_util_; | 105 scoped_ptr<storage::AsyncFileUtil> native_media_file_util_; |
107 scoped_ptr<DeviceMediaAsyncFileUtil> device_media_async_file_util_; | 106 scoped_ptr<DeviceMediaAsyncFileUtil> device_media_async_file_util_; |
108 #if defined(OS_WIN) || defined(OS_MACOSX) | 107 #if defined(OS_WIN) || defined(OS_MACOSX) |
109 scoped_ptr<storage::AsyncFileUtil> picasa_file_util_; | 108 scoped_ptr<storage::AsyncFileUtil> picasa_file_util_; |
110 scoped_ptr<storage::AsyncFileUtil> itunes_file_util_; | 109 scoped_ptr<storage::AsyncFileUtil> itunes_file_util_; |
111 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 110 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
112 #if defined(OS_MACOSX) | 111 #if defined(OS_MACOSX) |
113 scoped_ptr<storage::AsyncFileUtil> iphoto_file_util_; | 112 scoped_ptr<storage::AsyncFileUtil> iphoto_file_util_; |
114 #endif // defined(OS_MACOSX) | 113 #endif // defined(OS_MACOSX) |
115 | 114 |
116 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemBackend); | 115 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemBackend); |
117 }; | 116 }; |
118 | 117 |
119 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ | 118 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |