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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h" | 15 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h" |
16 #include "chrome/browser/media_galleries/fileapi/itunes/itunes_file_util.h" | 16 #include "chrome/browser/media_galleries/fileapi/itunes/itunes_file_util.h" |
| 17 #include "chrome/browser/media_galleries/fileapi/media_file_validator_factory.h" |
17 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 18 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
18 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" | 19 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
19 #include "chrome/browser/media_galleries/fileapi/picasa/picasa_file_util.h" | 20 #include "chrome/browser/media_galleries/fileapi/picasa/picasa_file_util.h" |
20 #include "webkit/browser/blob/local_file_stream_reader.h" | 21 #include "webkit/browser/blob/local_file_stream_reader.h" |
21 #include "webkit/browser/fileapi/async_file_util_adapter.h" | 22 #include "webkit/browser/fileapi/async_file_util_adapter.h" |
22 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 23 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
23 #include "webkit/browser/fileapi/file_system_context.h" | 24 #include "webkit/browser/fileapi/file_system_context.h" |
24 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" | 25 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" |
25 #include "webkit/browser/fileapi/file_system_operation_context.h" | 26 #include "webkit/browser/fileapi/file_system_operation_context.h" |
26 #include "webkit/browser/fileapi/file_system_task_runners.h" | 27 #include "webkit/browser/fileapi/file_system_task_runners.h" |
(...skipping 11 matching lines...) Expand all Loading... |
38 namespace chrome { | 39 namespace chrome { |
39 | 40 |
40 const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] = | 41 const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] = |
41 "MediaPathFilterKey"; | 42 "MediaPathFilterKey"; |
42 const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] = | 43 const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] = |
43 "MTPDeviceDelegateKey"; | 44 "MTPDeviceDelegateKey"; |
44 | 45 |
45 MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( | 46 MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( |
46 const base::FilePath& profile_path) | 47 const base::FilePath& profile_path) |
47 : profile_path_(profile_path), | 48 : profile_path_(profile_path), |
48 media_path_filter_(new MediaPathFilter()), | 49 media_path_filter_(new MediaPathFilter), |
| 50 media_copy_or_move_file_validator_factory_(new MediaFileValidatorFactory), |
49 native_media_file_util_( | 51 native_media_file_util_( |
50 new fileapi::AsyncFileUtilAdapter(new NativeMediaFileUtil())), | 52 new fileapi::AsyncFileUtilAdapter(new NativeMediaFileUtil())), |
51 device_media_async_file_util_( | 53 device_media_async_file_util_( |
52 DeviceMediaAsyncFileUtil::Create(profile_path_)), | 54 DeviceMediaAsyncFileUtil::Create(profile_path_)), |
53 picasa_file_util_( | 55 picasa_file_util_( |
54 new fileapi::AsyncFileUtilAdapter(new picasa::PicasaFileUtil())), | 56 new fileapi::AsyncFileUtilAdapter(new picasa::PicasaFileUtil())), |
55 itunes_file_util_(new fileapi::AsyncFileUtilAdapter( | 57 itunes_file_util_(new fileapi::AsyncFileUtilAdapter( |
56 new itunes::ItunesFileUtil())) { | 58 new itunes::ItunesFileUtil())) { |
57 } | 59 } |
58 | 60 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 114 } |
113 | 115 |
114 fileapi::CopyOrMoveFileValidatorFactory* | 116 fileapi::CopyOrMoveFileValidatorFactory* |
115 MediaFileSystemMountPointProvider::GetCopyOrMoveFileValidatorFactory( | 117 MediaFileSystemMountPointProvider::GetCopyOrMoveFileValidatorFactory( |
116 fileapi::FileSystemType type, base::PlatformFileError* error_code) { | 118 fileapi::FileSystemType type, base::PlatformFileError* error_code) { |
117 DCHECK(error_code); | 119 DCHECK(error_code); |
118 *error_code = base::PLATFORM_FILE_OK; | 120 *error_code = base::PLATFORM_FILE_OK; |
119 switch (type) { | 121 switch (type) { |
120 case fileapi::kFileSystemTypeNativeMedia: | 122 case fileapi::kFileSystemTypeNativeMedia: |
121 case fileapi::kFileSystemTypeDeviceMedia: | 123 case fileapi::kFileSystemTypeDeviceMedia: |
| 124 case fileapi::kFileSystemTypeItunes: |
122 if (!media_copy_or_move_file_validator_factory_) { | 125 if (!media_copy_or_move_file_validator_factory_) { |
123 *error_code = base::PLATFORM_FILE_ERROR_SECURITY; | 126 *error_code = base::PLATFORM_FILE_ERROR_SECURITY; |
124 return NULL; | 127 return NULL; |
125 } | 128 } |
126 return media_copy_or_move_file_validator_factory_.get(); | 129 return media_copy_or_move_file_validator_factory_.get(); |
127 default: | 130 default: |
128 NOTREACHED(); | 131 NOTREACHED(); |
129 } | 132 } |
130 return NULL; | 133 return NULL; |
131 } | 134 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void MediaFileSystemMountPointProvider::DeleteFileSystem( | 191 void MediaFileSystemMountPointProvider::DeleteFileSystem( |
189 const GURL& origin_url, | 192 const GURL& origin_url, |
190 fileapi::FileSystemType type, | 193 fileapi::FileSystemType type, |
191 FileSystemContext* context, | 194 FileSystemContext* context, |
192 const DeleteFileSystemCallback& callback) { | 195 const DeleteFileSystemCallback& callback) { |
193 NOTREACHED(); | 196 NOTREACHED(); |
194 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 197 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
195 } | 198 } |
196 | 199 |
197 } // namespace chrome | 200 } // namespace chrome |
OLD | NEW |