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

Unified Diff: chrome/renderer/webplugin_delegate_pepper.cc

Issue 340050: Add the plumbing and test code for plugins opening files from the sandbox. Th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « chrome/renderer/webplugin_delegate_pepper.h ('k') | webkit/glue/pepper/pepper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/webplugin_delegate_pepper.cc
===================================================================
--- chrome/renderer/webplugin_delegate_pepper.cc (revision 30698)
+++ chrome/renderer/webplugin_delegate_pepper.cc (working copy)
@@ -16,6 +16,8 @@
#include "base/scoped_ptr.h"
#include "base/stats_counters.h"
#include "base/string_util.h"
+#include "chrome/common/render_messages.h"
+#include "chrome/renderer/render_thread.h"
#include "webkit/api/public/WebInputEvent.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/pepper/pepper.h"
@@ -36,7 +38,9 @@
using WebKit::WebMouseWheelEvent;
namespace {
- const uint32 kBytesPerPixel = 4; // Only 8888 RGBA for now.
+
+const uint32 kBytesPerPixel = 4; // Only 8888 RGBA for now.
+
} // namespace
uint32 WebPluginDelegatePepper::next_buffer_id = 0;
@@ -444,3 +448,30 @@
committed_bitmap_.setIsOpaque(false);
return NPERR_NO_ERROR;
}
+
+NPError WebPluginDelegatePepper::OpenFileInSandbox(const char* file_name,
+ void** handle) {
+ *handle = NULL;
+
+#if defined(OS_WIN)
+ FilePath file_path(UTF8ToUTF16(file_name));
+#elif defined(OS_POSIX)
+ FilePath file_path(file_name);
+#endif
+
+ ViewMsg_OpenFileForPluginResponse_Params result;
+ RenderThread::current()->Send(new ViewMsg_OpenFileForPlugin(
+ file_path, &result));
+
+#if defined(OS_WIN)
+ if (!result.file_handle)
+ return NPERR_INVALID_PARAM;
+ *handle = result.file_handle;
+#elif defined(OS_POSIX)
+ if (!result.file_handle.fd)
+ return NPERR_INVALID_PARAM;
+ *static_cast<int*>(handle) = result.file_handle.fd;
+#endif
+
+ return NPERR_NO_ERROR;
+}
« no previous file with comments | « chrome/renderer/webplugin_delegate_pepper.h ('k') | webkit/glue/pepper/pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698