OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/fileapi/isolated_mount_point_provider.h" | 5 #include "webkit/fileapi/isolated_mount_point_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "webkit/fileapi/media/native_media_file_util.h" | 28 #include "webkit/fileapi/media/native_media_file_util.h" |
29 #include "webkit/fileapi/native_file_util.h" | 29 #include "webkit/fileapi/native_file_util.h" |
30 | 30 |
31 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 31 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |
32 #include "webkit/fileapi/media/device_media_file_util.h" | 32 #include "webkit/fileapi/media/device_media_file_util.h" |
33 #endif | 33 #endif |
34 | 34 |
35 namespace fileapi { | 35 namespace fileapi { |
36 | 36 |
37 IsolatedMountPointProvider::IsolatedMountPointProvider( | 37 IsolatedMountPointProvider::IsolatedMountPointProvider( |
38 const FilePath& profile_path) | 38 const base::FilePath& profile_path) |
39 : profile_path_(profile_path), | 39 : profile_path_(profile_path), |
40 media_path_filter_(new MediaPathFilter()), | 40 media_path_filter_(new MediaPathFilter()), |
41 isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())), | 41 isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())), |
42 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), | 42 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), |
43 native_media_file_util_( | 43 native_media_file_util_( |
44 new AsyncFileUtilAdapter(new NativeMediaFileUtil())) { | 44 new AsyncFileUtilAdapter(new NativeMediaFileUtil())) { |
45 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 45 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |
46 // TODO(kmadhusu): Initialize |device_media_file_util_| in | 46 // TODO(kmadhusu): Initialize |device_media_file_util_| in |
47 // initialization list. | 47 // initialization list. |
48 device_media_file_util_.reset( | 48 device_media_file_util_.reset( |
49 new AsyncFileUtilAdapter(new DeviceMediaFileUtil(profile_path_))); | 49 new AsyncFileUtilAdapter(new DeviceMediaFileUtil(profile_path_))); |
50 #endif | 50 #endif |
51 } | 51 } |
52 | 52 |
53 IsolatedMountPointProvider::~IsolatedMountPointProvider() { | 53 IsolatedMountPointProvider::~IsolatedMountPointProvider() { |
54 } | 54 } |
55 | 55 |
56 void IsolatedMountPointProvider::ValidateFileSystemRoot( | 56 void IsolatedMountPointProvider::ValidateFileSystemRoot( |
57 const GURL& origin_url, | 57 const GURL& origin_url, |
58 FileSystemType type, | 58 FileSystemType type, |
59 bool create, | 59 bool create, |
60 const ValidateFileSystemCallback& callback) { | 60 const ValidateFileSystemCallback& callback) { |
61 // We never allow opening a new isolated FileSystem via usual OpenFileSystem. | 61 // We never allow opening a new isolated FileSystem via usual OpenFileSystem. |
62 base::MessageLoopProxy::current()->PostTask( | 62 base::MessageLoopProxy::current()->PostTask( |
63 FROM_HERE, | 63 FROM_HERE, |
64 base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); | 64 base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); |
65 } | 65 } |
66 | 66 |
67 FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( | 67 base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( |
68 const FileSystemURL& url, | 68 const FileSystemURL& url, |
69 bool create) { | 69 bool create) { |
70 // This is not supposed to be used. | 70 // This is not supposed to be used. |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 return FilePath(); | 72 return base::FilePath(); |
73 } | 73 } |
74 | 74 |
75 bool IsolatedMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { | 75 bool IsolatedMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { |
76 return true; | 76 return true; |
77 } | 77 } |
78 | 78 |
79 bool IsolatedMountPointProvider::IsRestrictedFileName( | 79 bool IsolatedMountPointProvider::IsRestrictedFileName( |
80 const FilePath& filename) const { | 80 const base::FilePath& filename) const { |
81 // TODO(kinuko): We need to check platform-specific restricted file names | 81 // TODO(kinuko): We need to check platform-specific restricted file names |
82 // before we actually start allowing file creation in isolated file systems. | 82 // before we actually start allowing file creation in isolated file systems. |
83 return false; | 83 return false; |
84 } | 84 } |
85 | 85 |
86 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( | 86 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( |
87 FileSystemType type) { | 87 FileSystemType type) { |
88 switch (type) { | 88 switch (type) { |
89 case kFileSystemTypeNativeLocal: | 89 case kFileSystemTypeNativeLocal: |
90 return isolated_file_util_->sync_file_util(); | 90 return isolated_file_util_->sync_file_util(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 void IsolatedMountPointProvider::DeleteFileSystem( | 180 void IsolatedMountPointProvider::DeleteFileSystem( |
181 const GURL& origin_url, | 181 const GURL& origin_url, |
182 FileSystemType type, | 182 FileSystemType type, |
183 FileSystemContext* context, | 183 FileSystemContext* context, |
184 const DeleteFileSystemCallback& callback) { | 184 const DeleteFileSystemCallback& callback) { |
185 NOTREACHED(); | 185 NOTREACHED(); |
186 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 186 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
187 } | 187 } |
188 | 188 |
189 } // namespace fileapi | 189 } // namespace fileapi |
OLD | NEW |