summaryrefslogtreecommitdiffstats
path: root/content/utility
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-27 18:05:15 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-27 18:05:15 +0000
commit4912595f15ad54608207cbacaeeb085cf542e539 (patch)
tree0d32785d543ed97e3999673eda92fe81323773ef /content/utility
parent6c36f5e4b14f45fd54d60fa9abe7fc99c749eb49 (diff)
downloadchromium_src-4912595f15ad54608207cbacaeeb085cf542e539.zip
chromium_src-4912595f15ad54608207cbacaeeb085cf542e539.tar.gz
chromium_src-4912595f15ad54608207cbacaeeb085cf542e539.tar.bz2
Move plugin loading out of process on Mac and Linux.
This creates a new set of IPC messages for the utility process to load plugins to get the WebPluginInfo data in a separate process. Previously this was done in the browser process, but that involves loading arbitrary third-party code into the address space and then executing it. BUG=17863,95114 TEST=Plugins work as before. Review URL: http://codereview.chromium.org/7889025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/utility')
-rw-r--r--content/utility/utility_thread.cc39
-rw-r--r--content/utility/utility_thread.h12
2 files changed, 51 insertions, 0 deletions
diff --git a/content/utility/utility_thread.cc b/content/utility/utility_thread.cc
index ac6c312..a642ea1 100644
--- a/content/utility/utility_thread.cc
+++ b/content/utility/utility_thread.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include "base/file_path.h"
#include "content/common/child_process.h"
#include "content/common/indexed_db_key.h"
#include "content/common/utility_messages.h"
@@ -15,6 +16,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h"
#include "webkit/glue/idb_bindings.h"
#include "webkit/glue/webkitplatformsupport_impl.h"
+#include "webkit/plugins/npapi/plugin_list.h"
namespace {
@@ -50,6 +52,9 @@ bool UtilityThread::OnControlMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(UtilityMsg_InjectIDBKey, OnInjectIDBKey)
IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted)
IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished)
+#if defined(OS_POSIX)
+ IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins)
+#endif // OS_POSIX
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -91,6 +96,40 @@ void UtilityThread::OnBatchModeFinished() {
ChildProcess::current()->ReleaseProcess();
}
+#if defined(OS_POSIX)
+void UtilityThread::OnLoadPlugins(
+ const std::vector<FilePath>& extra_plugin_paths,
+ const std::vector<FilePath>& extra_plugin_dirs,
+ const std::vector<webkit::WebPluginInfo>& internal_plugins) {
+ webkit::npapi::PluginList* plugin_list =
+ webkit::npapi::PluginList::Singleton();
+
+ // Create the PluginList and set the paths from which to load plugins. Iterate
+ // in reverse to preserve the order when pushing back.
+ std::vector<FilePath>::const_reverse_iterator it;
+ for (it = extra_plugin_paths.rbegin();
+ it != extra_plugin_paths.rend();
+ ++it) {
+ plugin_list->AddExtraPluginPath(*it);
+ }
+ for (it = extra_plugin_dirs.rbegin(); it != extra_plugin_dirs.rend(); ++it) {
+ plugin_list->AddExtraPluginDir(*it);
+ }
+ for (std::vector<webkit::WebPluginInfo>::const_reverse_iterator it =
+ internal_plugins.rbegin();
+ it != internal_plugins.rend();
+ ++it) {
+ plugin_list->RegisterInternalPlugin(*it);
+ }
+
+ std::vector<webkit::WebPluginInfo> plugins;
+ plugin_list->GetPlugins(&plugins);
+
+ Send(new UtilityHostMsg_LoadedPlugins(plugins));
+ UtilityThread::current()->ReleaseProcessIfNeeded();
+}
+#endif
+
void UtilityThread::ReleaseProcessIfNeeded() {
if (!batch_mode_)
ChildProcess::current()->ReleaseProcess();
diff --git a/content/utility/utility_thread.h b/content/utility/utility_thread.h
index bc19482..8489a65 100644
--- a/content/utility/utility_thread.h
+++ b/content/utility/utility_thread.h
@@ -15,9 +15,14 @@
#include "content/common/child_thread.h"
#include "content/common/content_export.h"
+class FilePath;
class IndexedDBKey;
class SerializedScriptValue;
+namespace webkit {
+struct WebPluginInfo;
+}
+
namespace webkit_glue {
class WebKitPlatformSupportImpl;
}
@@ -51,6 +56,13 @@ class UtilityThread : public ChildThread {
void OnBatchModeStarted();
void OnBatchModeFinished();
+#if defined(OS_POSIX)
+ void OnLoadPlugins(
+ const std::vector<FilePath>& extra_plugin_paths,
+ const std::vector<FilePath>& extra_plugin_dirs,
+ const std::vector<webkit::WebPluginInfo>& internal_plugins);
+#endif // OS_POSIX
+
// True when we're running in batch mode.
bool batch_mode_;