| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ppb_flash_file_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_file_proxy.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 *contents = new PP_DirContents_Dev; | 475 *contents = new PP_DirContents_Dev; |
| 476 (*contents)->count = static_cast<int32_t>(entries.size()); | 476 (*contents)->count = static_cast<int32_t>(entries.size()); |
| 477 (*contents)->entries = new PP_DirEntry_Dev[entries.size()]; | 477 (*contents)->entries = new PP_DirEntry_Dev[entries.size()]; |
| 478 for (size_t i = 0; i < entries.size(); i++) { | 478 for (size_t i = 0; i < entries.size(); i++) { |
| 479 const SerializedDirEntry& source = entries[i]; | 479 const SerializedDirEntry& source = entries[i]; |
| 480 PP_DirEntry_Dev* dest = &(*contents)->entries[i]; | 480 PP_DirEntry_Dev* dest = &(*contents)->entries[i]; |
| 481 | 481 |
| 482 char* name_copy = new char[source.name.size() + 1]; | 482 char* name_copy = new char[source.name.size() + 1]; |
| 483 memcpy(name_copy, source.name.c_str(), source.name.size() + 1); | 483 memcpy(name_copy, source.name.c_str(), source.name.size() + 1); |
| 484 dest->name = name_copy; | 484 dest->name = name_copy; |
| 485 dest->is_dir = BoolToPPBool(source.is_dir); | 485 dest->is_dir = PP_FromBool(source.is_dir); |
| 486 } | 486 } |
| 487 | 487 |
| 488 return result; | 488 return result; |
| 489 } | 489 } |
| 490 | 490 |
| 491 const PPB_Flash_File_ModuleLocal flash_file_modulelocal_interface = { | 491 const PPB_Flash_File_ModuleLocal flash_file_modulelocal_interface = { |
| 492 &CreateThreadAdapterForInstance, | 492 &CreateThreadAdapterForInstance, |
| 493 &ClearThreadAdapterForInstance, | 493 &ClearThreadAdapterForInstance, |
| 494 &OpenModuleLocalFile, | 494 &OpenModuleLocalFile, |
| 495 &RenameModuleLocalFile, | 495 &RenameModuleLocalFile, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 PP_DirContents_Dev* contents = NULL; | 604 PP_DirContents_Dev* contents = NULL; |
| 605 *result = ppb_flash_file_module_local_target()-> | 605 *result = ppb_flash_file_module_local_target()-> |
| 606 GetDirContents(instance, path.c_str(), &contents); | 606 GetDirContents(instance, path.c_str(), &contents); |
| 607 if (*result != PP_OK) | 607 if (*result != PP_OK) |
| 608 return; | 608 return; |
| 609 | 609 |
| 610 // Convert the list of entries to the serialized version. | 610 // Convert the list of entries to the serialized version. |
| 611 entries->resize(contents->count); | 611 entries->resize(contents->count); |
| 612 for (int32_t i = 0; i < contents->count; i++) { | 612 for (int32_t i = 0; i < contents->count; i++) { |
| 613 (*entries)[i].name.assign(contents->entries[i].name); | 613 (*entries)[i].name.assign(contents->entries[i].name); |
| 614 (*entries)[i].is_dir = PPBoolToBool(contents->entries[i].is_dir); | 614 (*entries)[i].is_dir = PP_ToBool(contents->entries[i].is_dir); |
| 615 } | 615 } |
| 616 ppb_flash_file_module_local_target()->FreeDirContents(instance, contents); | 616 ppb_flash_file_module_local_target()->FreeDirContents(instance, contents); |
| 617 } | 617 } |
| 618 | 618 |
| 619 // PPB_Flash_File_FileRef ------------------------------------------------------ | 619 // PPB_Flash_File_FileRef ------------------------------------------------------ |
| 620 | 620 |
| 621 namespace { | 621 namespace { |
| 622 | 622 |
| 623 int32_t OpenFileRefFile(PP_Resource file_ref_id, | 623 int32_t OpenFileRefFile(PP_Resource file_ref_id, |
| 624 int32_t mode, | 624 int32_t mode, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 void PPB_Flash_File_FileRef_Proxy::OnMsgQueryFile( | 723 void PPB_Flash_File_FileRef_Proxy::OnMsgQueryFile( |
| 724 const HostResource& host_resource, | 724 const HostResource& host_resource, |
| 725 PP_FileInfo* info, | 725 PP_FileInfo* info, |
| 726 int32_t* result) { | 726 int32_t* result) { |
| 727 *result = ppb_flash_file_module_local_target()-> | 727 *result = ppb_flash_file_module_local_target()-> |
| 728 QueryFile(host_resource.host_resource(), info); | 728 QueryFile(host_resource.host_resource(), info); |
| 729 } | 729 } |
| 730 | 730 |
| 731 } // namespace proxy | 731 } // namespace proxy |
| 732 } // namespace pp | 732 } // namespace pp |
| OLD | NEW |