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

Unified Diff: webkit/plugins/ppapi/ppb_flash_file_impl.cc

Issue 7038032: Fix PP_FileOpenFlags_Dev handling: (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppb_file_io_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_flash_file_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_flash_file_impl.cc b/webkit/plugins/ppapi/ppb_flash_file_impl.cc
index cf657a9359dbcc054736453a84ffd9e9bfd8dd02..d285dff64ce8f1ca1a895c532f76c32fb0c13a9d 100644
--- a/webkit/plugins/ppapi/ppb_flash_file_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_file_impl.cc
@@ -12,8 +12,8 @@
#include "ppapi/c/dev/ppb_file_io_dev.h"
#include "ppapi/c/private/ppb_flash_file.h"
#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/error_util.h"
#include "webkit/plugins/ppapi/file_path.h"
+#include "webkit/plugins/ppapi/file_type_conversions.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
@@ -29,34 +29,6 @@ namespace ppapi {
namespace {
-// TODO(viettrungluu): The code below is duplicated in ppb_file_io_impl.cc
-// (where it's incorrect to boot).
-// Returns |true| if okay.
-bool ConvertFromPPFileOpenFlags(int32_t pp_open_flags, int* flags_out) {
- int flags = 0;
- if (pp_open_flags & PP_FILEOPENFLAG_READ)
- flags |= base::PLATFORM_FILE_READ;
- if (pp_open_flags & PP_FILEOPENFLAG_WRITE) {
- flags |= base::PLATFORM_FILE_WRITE;
- flags |= base::PLATFORM_FILE_WRITE_ATTRIBUTES;
- }
- if (pp_open_flags & PP_FILEOPENFLAG_TRUNCATE) {
- if (!(pp_open_flags & PP_FILEOPENFLAG_WRITE))
- return false;
- flags |= base::PLATFORM_FILE_TRUNCATE;
- }
- if (pp_open_flags & PP_FILEOPENFLAG_CREATE) {
- if (pp_open_flags & PP_FILEOPENFLAG_EXCLUSIVE)
- flags |= base::PLATFORM_FILE_CREATE;
- else
- flags |= base::PLATFORM_FILE_OPEN_ALWAYS;
- } else {
- flags |= base::PLATFORM_FILE_OPEN;
- }
- *flags_out = flags;
- return true;
-}
-
void FreeDirContents(PP_Instance instance, PP_DirContents_Dev* contents) {
DCHECK(contents);
for (int32_t i = 0; i < contents->count; ++i) {
@@ -84,7 +56,7 @@ int32_t OpenModuleLocalFile(PP_Instance pp_instance,
int32_t mode,
PP_FileHandle* file) {
int flags = 0;
- if (!path || !ConvertFromPPFileOpenFlags(mode, &flags) || !file)
+ if (!path || !PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file)
return PP_ERROR_BADARGUMENT;
PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
@@ -239,7 +211,7 @@ int32_t OpenFileRefFile(PP_Resource file_ref_id,
int32_t mode,
PP_FileHandle* file) {
int flags = 0;
- if (!ConvertFromPPFileOpenFlags(mode, &flags) || !file)
+ if (!PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file)
return PP_ERROR_BADARGUMENT;
scoped_refptr<PPB_FileRef_Impl> file_ref(
« no previous file with comments | « webkit/plugins/ppapi/ppb_file_io_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698