| 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 30 matching lines...) Expand all Loading... |
| 41 const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] = | 41 const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] = |
| 42 "MediaPathFilterKey"; | 42 "MediaPathFilterKey"; |
| 43 const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] = | 43 const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] = |
| 44 "MTPDeviceDelegateKey"; | 44 "MTPDeviceDelegateKey"; |
| 45 | 45 |
| 46 MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( | 46 MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( |
| 47 const base::FilePath& profile_path) | 47 const base::FilePath& profile_path) |
| 48 : profile_path_(profile_path), | 48 : profile_path_(profile_path), |
| 49 media_path_filter_(new MediaPathFilter), | 49 media_path_filter_(new MediaPathFilter), |
| 50 media_copy_or_move_file_validator_factory_(new MediaFileValidatorFactory), | 50 media_copy_or_move_file_validator_factory_(new MediaFileValidatorFactory), |
| 51 native_media_file_util_( | 51 native_media_file_util_(new NativeMediaFileUtil()), |
| 52 new fileapi::AsyncFileUtilAdapter(new NativeMediaFileUtil())), | |
| 53 device_media_async_file_util_( | 52 device_media_async_file_util_( |
| 54 DeviceMediaAsyncFileUtil::Create(profile_path_)), | 53 DeviceMediaAsyncFileUtil::Create(profile_path_)), |
| 55 picasa_file_util_( | 54 picasa_file_util_(new picasa::PicasaFileUtil()), |
| 56 new fileapi::AsyncFileUtilAdapter(new picasa::PicasaFileUtil())), | 55 itunes_file_util_(new itunes::ItunesFileUtil()) { |
| 57 itunes_file_util_(new fileapi::AsyncFileUtilAdapter( | |
| 58 new itunes::ItunesFileUtil())) { | |
| 59 } | 56 } |
| 60 | 57 |
| 61 MediaFileSystemMountPointProvider::~MediaFileSystemMountPointProvider() { | 58 MediaFileSystemMountPointProvider::~MediaFileSystemMountPointProvider() { |
| 62 } | 59 } |
| 63 | 60 |
| 64 bool MediaFileSystemMountPointProvider::CanHandleType( | 61 bool MediaFileSystemMountPointProvider::CanHandleType( |
| 65 fileapi::FileSystemType type) const { | 62 fileapi::FileSystemType type) const { |
| 66 switch (type) { | 63 switch (type) { |
| 67 case fileapi::kFileSystemTypeNativeMedia: | 64 case fileapi::kFileSystemTypeNativeMedia: |
| 68 case fileapi::kFileSystemTypeDeviceMedia: | 65 case fileapi::kFileSystemTypeDeviceMedia: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 fileapi::OpenFileSystemMode mode, | 77 fileapi::OpenFileSystemMode mode, |
| 81 const OpenFileSystemCallback& callback) { | 78 const OpenFileSystemCallback& callback) { |
| 82 // We never allow opening a new isolated FileSystem via usual OpenFileSystem. | 79 // We never allow opening a new isolated FileSystem via usual OpenFileSystem. |
| 83 base::MessageLoopProxy::current()->PostTask( | 80 base::MessageLoopProxy::current()->PostTask( |
| 84 FROM_HERE, | 81 FROM_HERE, |
| 85 base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); | 82 base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); |
| 86 } | 83 } |
| 87 | 84 |
| 88 fileapi::FileSystemFileUtil* MediaFileSystemMountPointProvider::GetFileUtil( | 85 fileapi::FileSystemFileUtil* MediaFileSystemMountPointProvider::GetFileUtil( |
| 89 fileapi::FileSystemType type) { | 86 fileapi::FileSystemType type) { |
| 90 switch (type) { | 87 NOTREACHED(); |
| 91 case fileapi::kFileSystemTypeNativeMedia: | |
| 92 return native_media_file_util_->sync_file_util(); | |
| 93 default: | |
| 94 NOTREACHED(); | |
| 95 } | |
| 96 return NULL; | 88 return NULL; |
| 97 } | 89 } |
| 98 | 90 |
| 99 fileapi::AsyncFileUtil* MediaFileSystemMountPointProvider::GetAsyncFileUtil( | 91 fileapi::AsyncFileUtil* MediaFileSystemMountPointProvider::GetAsyncFileUtil( |
| 100 fileapi::FileSystemType type) { | 92 fileapi::FileSystemType type) { |
| 101 switch (type) { | 93 switch (type) { |
| 102 case fileapi::kFileSystemTypeNativeMedia: | 94 case fileapi::kFileSystemTypeNativeMedia: |
| 103 return native_media_file_util_.get(); | 95 return native_media_file_util_.get(); |
| 104 case fileapi::kFileSystemTypePicasa: | 96 case fileapi::kFileSystemTypePicasa: |
| 105 return picasa_file_util_.get(); | 97 return picasa_file_util_.get(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 void MediaFileSystemMountPointProvider::DeleteFileSystem( | 183 void MediaFileSystemMountPointProvider::DeleteFileSystem( |
| 192 const GURL& origin_url, | 184 const GURL& origin_url, |
| 193 fileapi::FileSystemType type, | 185 fileapi::FileSystemType type, |
| 194 FileSystemContext* context, | 186 FileSystemContext* context, |
| 195 const DeleteFileSystemCallback& callback) { | 187 const DeleteFileSystemCallback& callback) { |
| 196 NOTREACHED(); | 188 NOTREACHED(); |
| 197 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 189 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
| 198 } | 190 } |
| 199 | 191 |
| 200 } // namespace chrome | 192 } // namespace chrome |
| OLD | NEW |