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 "ppapi/proxy/flash_file_resource.h" | 5 #include "ppapi/proxy/flash_file_resource.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); | 199 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); |
200 return PP_OK; | 200 return PP_OK; |
201 } | 201 } |
202 | 202 |
203 int32_t FlashFileResource::QueryFileHelper(const std::string& path, | 203 int32_t FlashFileResource::QueryFileHelper(const std::string& path, |
204 PepperFilePath::Domain domain_type, | 204 PepperFilePath::Domain domain_type, |
205 PP_FileInfo* info) { | 205 PP_FileInfo* info) { |
206 if (path.empty() || !info) | 206 if (path.empty() || !info) |
207 return PP_ERROR_BADARGUMENT; | 207 return PP_ERROR_BADARGUMENT; |
208 | 208 |
209 base::PlatformFileInfo file_info; | 209 base::File::Info file_info; |
210 PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path)); | 210 PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path)); |
211 | 211 |
212 int32_t error = SyncCall<PpapiPluginMsg_FlashFile_QueryFileReply>(BROWSER, | 212 int32_t error = SyncCall<PpapiPluginMsg_FlashFile_QueryFileReply>(BROWSER, |
213 PpapiHostMsg_FlashFile_QueryFile(pepper_path), &file_info); | 213 PpapiHostMsg_FlashFile_QueryFile(pepper_path), &file_info); |
214 | 214 |
215 if (error == PP_OK) { | 215 if (error == PP_OK) { |
216 info->size = file_info.size; | 216 info->size = file_info.size; |
217 info->creation_time = TimeToPPTime(file_info.creation_time); | 217 info->creation_time = TimeToPPTime(file_info.creation_time); |
218 info->last_access_time = TimeToPPTime(file_info.last_accessed); | 218 info->last_access_time = TimeToPPTime(file_info.last_accessed); |
219 info->last_modified_time = TimeToPPTime(file_info.last_modified); | 219 info->last_modified_time = TimeToPPTime(file_info.last_modified); |
220 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; | 220 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; |
221 if (file_info.is_directory) | 221 if (file_info.is_directory) |
222 info->type = PP_FILETYPE_DIRECTORY; | 222 info->type = PP_FILETYPE_DIRECTORY; |
223 else | 223 else |
224 info->type = PP_FILETYPE_REGULAR; | 224 info->type = PP_FILETYPE_REGULAR; |
225 } | 225 } |
226 | 226 |
227 return error; | 227 return error; |
228 } | 228 } |
229 | 229 |
230 } // namespace proxy | 230 } // namespace proxy |
231 } // namespace ppapi | 231 } // namespace ppapi |
OLD | NEW |