summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 00:21:47 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 00:21:47 +0000
commit564551a2ece790b22fd2a70aeb8591805fe943be (patch)
tree4a488ae255344ea3c84e34976816508a23d228e0 /chrome/browser/renderer_host
parentfa6797241c533cc2c2ce0504f68decdea990c59f (diff)
downloadchromium_src-564551a2ece790b22fd2a70aeb8591805fe943be.zip
chromium_src-564551a2ece790b22fd2a70aeb8591805fe943be.tar.gz
chromium_src-564551a2ece790b22fd2a70aeb8591805fe943be.tar.bz2
Fix the problem that FileReader does not work on Mac/Linux. The fix
is to pass the file handle with magic FileDescriptor over IPC for POSIX. BUG=none TEST=none Review URL: http://codereview.chromium.org/2123001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 791cd5b..f27ee9b 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -7,6 +7,9 @@
#include "app/clipboard/clipboard.h"
#include "base/callback.h"
#include "base/command_line.h"
+#if defined(OS_POSIX)
+#include "base/file_descriptor_posix.h"
+#endif
#include "base/file_util.h"
#include "base/histogram.h"
#include "base/process_util.h"
@@ -1385,7 +1388,13 @@ void ResourceMessageFilter::OnOpenFile(const FilePath& path,
// TODO(jianli): Do we need separate permission to control opening the file?
if (!ChildProcessSecurityPolicy::GetInstance()->CanUploadFile(id(), path)) {
ViewHostMsg_OpenFile::WriteReplyParams(
- reply_msg, base::kInvalidPlatformFileValue);
+ reply_msg,
+#if defined(OS_WIN)
+ base::kInvalidPlatformFileValue
+#elif defined(OS_POSIX)
+ base::FileDescriptor(base::kInvalidPlatformFileValue, true)
+#endif
+ );
Send(reply_msg);
return;
}
@@ -1424,7 +1433,14 @@ void ResourceMessageFilter::OnOpenFileOnFileThread(const FilePath& path,
target_file_handle = file_handle;
#endif
- ViewHostMsg_OpenFile::WriteReplyParams(reply_msg, target_file_handle);
+ ViewHostMsg_OpenFile::WriteReplyParams(
+ reply_msg,
+#if defined(OS_WIN)
+ target_file_handle
+#elif defined(OS_POSIX)
+ base::FileDescriptor(target_file_handle, true)
+#endif
+ );
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,