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 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p
rovider.h" | 5 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p
rovider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "webkit/browser/fileapi/local_file_system_operation.h" | 31 #include "webkit/browser/fileapi/local_file_system_operation.h" |
32 #include "webkit/browser/fileapi/native_file_util.h" | 32 #include "webkit/browser/fileapi/native_file_util.h" |
33 #include "webkit/common/fileapi/file_system_types.h" | 33 #include "webkit/common/fileapi/file_system_types.h" |
34 #include "webkit/common/fileapi/file_system_util.h" | 34 #include "webkit/common/fileapi/file_system_util.h" |
35 | 35 |
36 using fileapi::FileSystemContext; | 36 using fileapi::FileSystemContext; |
37 using fileapi::FileSystemURL; | 37 using fileapi::FileSystemURL; |
38 | 38 |
39 namespace chrome { | 39 namespace chrome { |
40 | 40 |
| 41 const char MediaFileSystemMountPointProvider::kMediaTaskRunnerName[] = |
| 42 "media-task-runner"; |
41 const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] = | 43 const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] = |
42 "MediaPathFilterKey"; | 44 "MediaPathFilterKey"; |
43 const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] = | 45 const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] = |
44 "MTPDeviceDelegateKey"; | 46 "MTPDeviceDelegateKey"; |
45 | 47 |
46 MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( | 48 MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( |
47 const base::FilePath& profile_path) | 49 const base::FilePath& profile_path, |
| 50 base::SequencedTaskRunner* media_task_runner) |
48 : profile_path_(profile_path), | 51 : profile_path_(profile_path), |
| 52 media_task_runner_(media_task_runner), |
49 media_path_filter_(new MediaPathFilter), | 53 media_path_filter_(new MediaPathFilter), |
50 media_copy_or_move_file_validator_factory_(new MediaFileValidatorFactory), | 54 media_copy_or_move_file_validator_factory_(new MediaFileValidatorFactory), |
51 native_media_file_util_(new NativeMediaFileUtil()), | 55 native_media_file_util_(new NativeMediaFileUtil()), |
52 device_media_async_file_util_( | 56 device_media_async_file_util_( |
53 DeviceMediaAsyncFileUtil::Create(profile_path_)), | 57 DeviceMediaAsyncFileUtil::Create(profile_path_)), |
54 picasa_file_util_(new picasa::PicasaFileUtil()), | 58 picasa_file_util_(new picasa::PicasaFileUtil()), |
55 itunes_file_util_(new itunes::ItunesFileUtil()) { | 59 itunes_file_util_(new itunes::ItunesFileUtil()) { |
56 } | 60 } |
57 | 61 |
58 MediaFileSystemMountPointProvider::~MediaFileSystemMountPointProvider() { | 62 MediaFileSystemMountPointProvider::~MediaFileSystemMountPointProvider() { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return fileapi::FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; | 137 return fileapi::FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; |
134 } | 138 } |
135 | 139 |
136 fileapi::FileSystemOperation* | 140 fileapi::FileSystemOperation* |
137 MediaFileSystemMountPointProvider::CreateFileSystemOperation( | 141 MediaFileSystemMountPointProvider::CreateFileSystemOperation( |
138 const FileSystemURL& url, | 142 const FileSystemURL& url, |
139 FileSystemContext* context, | 143 FileSystemContext* context, |
140 base::PlatformFileError* error_code) const { | 144 base::PlatformFileError* error_code) const { |
141 scoped_ptr<fileapi::FileSystemOperationContext> operation_context( | 145 scoped_ptr<fileapi::FileSystemOperationContext> operation_context( |
142 new fileapi::FileSystemOperationContext( | 146 new fileapi::FileSystemOperationContext( |
143 context, context->task_runners()->media_task_runner())); | 147 context, media_task_runner_.get())); |
144 | 148 |
145 operation_context->SetUserValue(kMediaPathFilterKey, | 149 operation_context->SetUserValue(kMediaPathFilterKey, |
146 media_path_filter_.get()); | 150 media_path_filter_.get()); |
147 if (url.type() == fileapi::kFileSystemTypeDeviceMedia) { | 151 if (url.type() == fileapi::kFileSystemTypeDeviceMedia) { |
148 operation_context->SetUserValue(kMTPDeviceDelegateURLKey, | 152 operation_context->SetUserValue(kMTPDeviceDelegateURLKey, |
149 url.filesystem_id()); | 153 url.filesystem_id()); |
150 } | 154 } |
151 | 155 |
152 return new fileapi::LocalFileSystemOperation(context, | 156 return new fileapi::LocalFileSystemOperation(context, |
153 operation_context.Pass()); | 157 operation_context.Pass()); |
(...skipping 29 matching lines...) Expand all Loading... |
183 void MediaFileSystemMountPointProvider::DeleteFileSystem( | 187 void MediaFileSystemMountPointProvider::DeleteFileSystem( |
184 const GURL& origin_url, | 188 const GURL& origin_url, |
185 fileapi::FileSystemType type, | 189 fileapi::FileSystemType type, |
186 FileSystemContext* context, | 190 FileSystemContext* context, |
187 const DeleteFileSystemCallback& callback) { | 191 const DeleteFileSystemCallback& callback) { |
188 NOTREACHED(); | 192 NOTREACHED(); |
189 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 193 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
190 } | 194 } |
191 | 195 |
192 } // namespace chrome | 196 } // namespace chrome |
OLD | NEW |