Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: webkit/fileapi/media/device_media_file_util.cc

Issue 10781014: Isolated FS for media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "webkit/fileapi/media/device_media_file_util.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "webkit/blob/shareable_file_reference.h"
9 #include "webkit/fileapi/file_system_operation_context.h"
10 #include "webkit/fileapi/file_system_url.h"
11 #include "webkit/fileapi/isolated_context.h"
12 #include "webkit/fileapi/media/media_device_map_service.h"
13 #include "webkit/fileapi/media/media_device_interface_impl.h"
14
15 using base::PlatformFileError;
16 using base::PlatformFileInfo;
17
18 namespace fileapi {
19
20 DeviceMediaFileUtil::DeviceMediaFileUtil() {
21 }
22
23 PlatformFileError DeviceMediaFileUtil::CreateOrOpen(
24 FileSystemOperationContext* context,
25 const FileSystemURL& url, int file_flags,
26 PlatformFile* file_handle, bool* created) {
27 return base::PLATFORM_FILE_ERROR_SECURITY;
28 }
29
30 PlatformFileError DeviceMediaFileUtil::Close(
31 FileSystemOperationContext* context,
32 PlatformFile file_handle) {
33 // We don't allow open thus Close won't be called.
34 return base::PLATFORM_FILE_ERROR_SECURITY;
35 }
36
37 PlatformFileError DeviceMediaFileUtil::EnsureFileExists(
38 FileSystemOperationContext* context,
39 const FileSystemURL& url,
40 bool* created) {
41 return base::PLATFORM_FILE_ERROR_SECURITY;
42 }
43
44 PlatformFileError DeviceMediaFileUtil::CreateDirectory(
45 FileSystemOperationContext* context,
46 const FileSystemURL& url,
47 bool exclusive,
48 bool recursive) {
49 return base::PLATFORM_FILE_ERROR_SECURITY;
50 }
51
52 PlatformFileError DeviceMediaFileUtil::GetFileInfo(
53 FileSystemOperationContext* context,
54 const FileSystemURL& url,
55 PlatformFileInfo* file_info,
56 FilePath* platform_path) {
57 scoped_refptr<MediaDeviceInterfaceImpl> device(context->media_device());
58 if (!device.get())
59 return base::PLATFORM_FILE_ERROR_INVALID_URL;
60 *platform_path = url.path();
61 return device->GetFileInfo(*platform_path, file_info);
62 }
63
64 FileSystemFileUtil::AbstractFileEnumerator*
65 DeviceMediaFileUtil::CreateFileEnumerator(
66 FileSystemOperationContext* context,
67 const FileSystemURL& url,
68 bool recursive) {
69 scoped_refptr<MediaDeviceInterfaceImpl> device(context->media_device());
70 if (!device.get())
71 return new FileSystemFileUtil::EmptyFileEnumerator();
72 return device->CreateFileEnumerator(url.path(), recursive);
73 }
74
75 PlatformFileError DeviceMediaFileUtil::GetLocalFilePath(
76 FileSystemOperationContext* context,
77 const FileSystemURL& file_system_url,
78 FilePath* local_file_path) {
79 return base::PLATFORM_FILE_ERROR_SECURITY;
80 }
81
82 PlatformFileError DeviceMediaFileUtil::Touch(
83 FileSystemOperationContext* context,
84 const FileSystemURL& url,
85 const base::Time& last_access_time,
86 const base::Time& last_modified_time) {
87 scoped_refptr<MediaDeviceInterfaceImpl> device(context->media_device());
88 if (!device.get())
89 return base::PLATFORM_FILE_ERROR_INVALID_URL;
90 return device->Touch(url.path(), last_access_time, last_modified_time);
91 }
92
93 PlatformFileError DeviceMediaFileUtil::Truncate(
94 FileSystemOperationContext* context,
95 const FileSystemURL& url,
96 int64 length) {
97 return base::PLATFORM_FILE_ERROR_SECURITY;
98 }
99
100 bool DeviceMediaFileUtil::PathExists(
101 FileSystemOperationContext* context,
102 const FileSystemURL& url) {
103 scoped_refptr<MediaDeviceInterfaceImpl> device(context->media_device());
104 if (!device.get())
105 return false;
106 return device->PathExists(url.path());
107 }
108
109 bool DeviceMediaFileUtil::DirectoryExists(
110 FileSystemOperationContext* context,
111 const FileSystemURL& url) {
112 scoped_refptr<MediaDeviceInterfaceImpl> device(context->media_device());
113 if (!device.get())
114 return false;
115 return device->DirectoryExists(url.path());
116 }
117
118 bool DeviceMediaFileUtil::IsDirectoryEmpty(
119 FileSystemOperationContext* context,
120 const FileSystemURL& url) {
121 scoped_refptr<MediaDeviceInterfaceImpl> device(context->media_device());
122 if (!device.get())
123 return false;
124 return device->IsDirectoryEmpty(url.path());
125 }
126
127 PlatformFileError DeviceMediaFileUtil::CopyOrMoveFile(
128 FileSystemOperationContext* context,
129 const FileSystemURL& src_url,
130 const FileSystemURL& dest_url,
131 bool copy) {
132 return base::PLATFORM_FILE_ERROR_SECURITY;
133 }
134
135 PlatformFileError DeviceMediaFileUtil::CopyInForeignFile(
136 FileSystemOperationContext* context,
137 const FilePath& src_file_path,
138 const FileSystemURL& dest_url) {
139 return base::PLATFORM_FILE_ERROR_SECURITY;
140 }
141
142 PlatformFileError DeviceMediaFileUtil::DeleteFile(
143 FileSystemOperationContext* context,
144 const FileSystemURL& url) {
145 return base::PLATFORM_FILE_ERROR_SECURITY;
146 }
147
148 PlatformFileError DeviceMediaFileUtil::DeleteSingleDirectory(
149 FileSystemOperationContext* context,
150 const FileSystemURL& url) {
151 return base::PLATFORM_FILE_ERROR_SECURITY;
152 }
153
154 scoped_refptr<webkit_blob::ShareableFileReference>
155 DeviceMediaFileUtil::CreateSnapshotFile(
156 FileSystemOperationContext* context,
157 const FileSystemURL& url,
158 base::PlatformFileError* result,
159 base::PlatformFileInfo* file_info,
160 FilePath* platform_path) {
161 return NULL;
162 }
163
164 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698