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

Unified Diff: chrome/renderer/render_process_impl.cc

Issue 1462001: Use internal pdf plugin with --internal-pdf (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | « chrome/common/chrome_switches.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_process_impl.cc
===================================================================
--- chrome/renderer/render_process_impl.cc (revision 42796)
+++ chrome/renderer/render_process_impl.cc (working copy)
@@ -33,6 +33,8 @@
#include "media/base/media.h"
#include "media/base/media_switches.h"
#include "native_client/src/trusted/plugin/nacl_entry_points.h"
+#include "webkit/glue/plugins/plugin_instance.h"
+#include "webkit/glue/plugins/plugin_lib.h"
#include "webkit/glue/webkit_glue.h"
#if defined(OS_MACOSX)
@@ -139,6 +141,21 @@
media::InitializeOpenMaxLibrary(module_path);
}
#endif
+
+ // Load the pdf plugin before the sandbox is turned on.
+ FilePath pdf;
+ if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf)) {
+ static scoped_refptr<NPAPI::PluginLib> pdf_lib =
+ NPAPI::PluginLib::CreatePluginLib(pdf);
+ // Actually load the plugin.
+ pdf_lib->NP_Initialize();
+ // Keep an instance around to prevent the plugin unloading after a pdf is
+ // closed.
+ // Don't use scoped_ptr here because then get asserts on process shut down
+ // when running in --single-process.
+ static NPAPI::PluginInstance* instance = pdf_lib->CreateInstance("");
+ instance->plugin_lib(); // Quiet unused variable warnings in gcc.
+ }
}
RenderProcessImpl::~RenderProcessImpl() {
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698