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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_impl.cc

Issue 10534045: Add CreateTemporaryFile to PPB_Flash_File_ModuleLocal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove input dir path and output file name Created 8 years, 6 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
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/plugins/ppapi/ppb_flash_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 #endif 516 #endif
517 size_t size = name.size() + 1; 517 size_t size = name.size() + 1;
518 char* name_copy = new char[size]; 518 char* name_copy = new char[size];
519 memcpy(name_copy, name.c_str(), size); 519 memcpy(name_copy, name.c_str(), size);
520 entry.name = name_copy; 520 entry.name = name_copy;
521 entry.is_dir = BoolToPPBool(pepper_contents[i].is_dir); 521 entry.is_dir = BoolToPPBool(pepper_contents[i].is_dir);
522 } 522 }
523 return PP_OK; 523 return PP_OK;
524 } 524 }
525 525
526 int32_t PPB_Flash_Impl::CreateTemporaryFile(PP_Instance instance,
527 PP_FileHandle* file) {
528 if (!file)
529 return PP_ERROR_BADARGUMENT;
530
531 PluginInstance* plugin_instance = HostGlobals::Get()->GetInstance(instance);
532 if (!plugin_instance) {
533 *file = PP_kInvalidFileHandle;
534 return PP_ERROR_FAILED;
535 }
536
537 base::PlatformFile temp_file = base::kInvalidPlatformFileValue;
viettrungluu 2012/06/11 17:31:46 Why do you need temp_file at all?
yzshen1 2012/06/12 23:53:06 Done. On 2012/06/11 17:31:46, viettrungluu wrote:
538 base::PlatformFileError result =
539 plugin_instance->delegate()->CreateTemporaryFile(&temp_file);
540 *file = temp_file;
541 return ::ppapi::PlatformFileErrorToPepperError(result);
542 }
543
526 int32_t PPB_Flash_Impl::OpenFileRef(PP_Instance pp_instance, 544 int32_t PPB_Flash_Impl::OpenFileRef(PP_Instance pp_instance,
527 PP_Resource file_ref_id, 545 PP_Resource file_ref_id,
528 int32_t mode, 546 int32_t mode,
529 PP_FileHandle* file) { 547 PP_FileHandle* file) {
530 int flags = 0; 548 int flags = 0;
531 if (!::ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file) 549 if (!::ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file)
532 return PP_ERROR_BADARGUMENT; 550 return PP_ERROR_BADARGUMENT;
533 551
534 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref_id, true); 552 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref_id, true);
535 if (enter.failed()) 553 if (enter.failed())
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } 667 }
650 case PP_FLASH_CLIPBOARD_FORMAT_INVALID: 668 case PP_FLASH_CLIPBOARD_FORMAT_INVALID:
651 break; 669 break;
652 } 670 }
653 671
654 return PP_ERROR_BADARGUMENT; 672 return PP_ERROR_BADARGUMENT;
655 } 673 }
656 674
657 } // namespace ppapi 675 } // namespace ppapi
658 } // namespace webkit 676 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698