summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 17:33:52 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 17:33:52 +0000
commit738a72134925300c3b62deff96239e53ee49c817 (patch)
tree94127c8687d95fc1971304f1e420b76063806389 /content
parent4d680a9e0eab6dc194d4761f96b0e0876d12e2ad (diff)
downloadchromium_src-738a72134925300c3b62deff96239e53ee49c817.zip
chromium_src-738a72134925300c3b62deff96239e53ee49c817.tar.gz
chromium_src-738a72134925300c3b62deff96239e53ee49c817.tar.bz2
Move PepperPluginInfo to content/public/common and put it into the content namespace.
BUG=98716 Review URL: http://codereview.chromium.org/8366027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/plugin_service.cc10
-rw-r--r--content/browser/plugin_service.h7
-rw-r--r--content/browser/ppapi_plugin_process_host.cc8
-rw-r--r--content/browser/ppapi_plugin_process_host.h10
-rw-r--r--content/common/pepper_plugin_registry.cc28
-rw-r--r--content/common/pepper_plugin_registry.h41
-rw-r--r--content/content_common.gypi2
-rw-r--r--content/public/common/content_client.h5
-rw-r--r--content/public/common/pepper_plugin_info.cc17
-rw-r--r--content/public/common/pepper_plugin_info.h47
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.cc2
-rw-r--r--content/shell/shell_content_client.cc2
-rw-r--r--content/shell/shell_content_client.h2
-rw-r--r--content/test/test_content_client.cc2
-rw-r--r--content/test/test_content_client.h2
15 files changed, 108 insertions, 77 deletions
diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc
index 378ee28..c189c31 100644
--- a/content/browser/plugin_service.cc
+++ b/content/browser/plugin_service.cc
@@ -284,7 +284,7 @@ PpapiPluginProcessHost* PluginService::FindOrStartPpapiPluginProcess(
return plugin_host;
// Validate that the plugin is actually registered.
- PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path);
+ content::PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path);
if (!info)
return NULL;
@@ -303,7 +303,7 @@ PpapiPluginProcessHost* PluginService::FindOrStartPpapiBrokerProcess(
return plugin_host;
// Validate that the plugin is actually registered.
- PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path);
+ content::PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path);
if (!info)
return NULL;
@@ -581,9 +581,9 @@ void PluginService::RegisterPepperPlugins() {
}
// There should generally be very few plugins so a brute-force search is fine.
-PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo(
+content::PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo(
const FilePath& plugin_path) {
- PepperPluginInfo* info = NULL;
+ content::PepperPluginInfo* info = NULL;
for (size_t i = 0; i < ppapi_plugins_.size(); i++) {
if (ppapi_plugins_[i].path == plugin_path) {
info = &ppapi_plugins_[i];
@@ -600,7 +600,7 @@ PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo(
webkit::WebPluginInfo webplugin_info;
if (!GetPluginInfoByPath(plugin_path, &webplugin_info))
return NULL;
- PepperPluginInfo new_pepper_info;
+ content::PepperPluginInfo new_pepper_info;
if (!MakePepperPluginInfo(webplugin_info, &new_pepper_info))
return NULL;
ppapi_plugins_.push_back(new_pepper_info);
diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service.h
index 5c4edc7..224d243 100644
--- a/content/browser/plugin_service.h
+++ b/content/browser/plugin_service.h
@@ -35,7 +35,6 @@
#include "base/files/file_path_watcher.h"
#endif
-struct PepperPluginInfo;
class PluginDirWatcherDelegate;
namespace base {
@@ -45,6 +44,7 @@ class MessageLoopProxy;
namespace content {
class BrowserContext;
class ResourceContext;
+struct PepperPluginInfo;
class PluginServiceFilter;
struct PluginServiceFilterParams;
}
@@ -192,7 +192,8 @@ class CONTENT_EXPORT PluginService
void RegisterPepperPlugins();
- PepperPluginInfo* GetRegisteredPpapiPluginInfo(const FilePath& plugin_path);
+ content::PepperPluginInfo* GetRegisteredPpapiPluginInfo(
+ const FilePath& plugin_path);
// Function that is run on the FILE thread to load the plugins synchronously.
void GetPluginsInternal(base::MessageLoopProxy* target_loop,
@@ -250,7 +251,7 @@ class CONTENT_EXPORT PluginService
scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_;
#endif
- std::vector<PepperPluginInfo> ppapi_plugins_;
+ std::vector<content::PepperPluginInfo> ppapi_plugins_;
// Weak pointer; outlives us.
content::PluginServiceFilter* filter_;
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc
index acc8f2b..d72dd55 100644
--- a/content/browser/ppapi_plugin_process_host.cc
+++ b/content/browser/ppapi_plugin_process_host.cc
@@ -10,8 +10,8 @@
#include "base/utf_string_conversions.h"
#include "content/browser/plugin_service.h"
#include "content/browser/renderer_host/render_message_filter.h"
-#include "content/common/pepper_plugin_registry.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/pepper_plugin_info.h"
#include "ipc/ipc_switches.h"
#include "net/base/network_change_notifier.h"
#include "ppapi/proxy/ppapi_messages.h"
@@ -56,7 +56,7 @@ PpapiPluginProcessHost::~PpapiPluginProcessHost() {
}
PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost(
- const PepperPluginInfo& info,
+ const content::PepperPluginInfo& info,
net::HostResolver* host_resolver) {
PpapiPluginProcessHost* plugin_host =
new PpapiPluginProcessHost(host_resolver);
@@ -68,7 +68,7 @@ PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost(
}
PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost(
- const PepperPluginInfo& info) {
+ const content::PepperPluginInfo& info) {
PpapiPluginProcessHost* plugin_host =
new PpapiPluginProcessHost();
if(plugin_host->Init(info))
@@ -104,7 +104,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost()
is_broker_(true) {
}
-bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
+bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) {
plugin_path_ = info.path;
set_name(UTF8ToUTF16(info.name));
set_version(UTF8ToUTF16(info.version));
diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h
index f31f10e..6fb67d5 100644
--- a/content/browser/ppapi_plugin_process_host.h
+++ b/content/browser/ppapi_plugin_process_host.h
@@ -15,9 +15,8 @@
#include "content/browser/browser_child_process_host.h"
#include "content/browser/renderer_host/pepper_message_filter.h"
-struct PepperPluginInfo;
-
namespace content {
+struct PepperPluginInfo;
class ResourceContext;
}
@@ -56,9 +55,10 @@ class PpapiPluginProcessHost
virtual ~PpapiPluginProcessHost();
static PpapiPluginProcessHost* CreatePluginHost(
- const PepperPluginInfo& info,
+ const content::PepperPluginInfo& info,
net::HostResolver* host_resolver);
- static PpapiPluginProcessHost* CreateBrokerHost(const PepperPluginInfo& info);
+ static PpapiPluginProcessHost* CreateBrokerHost(
+ const content::PepperPluginInfo& info);
// Opens a new channel to the plugin. The client will be notified when the
// channel is ready or if there's an error.
@@ -78,7 +78,7 @@ class PpapiPluginProcessHost
// Actually launches the process with the given plugin info. Returns true
// on success (the process was spawned).
- bool Init(const PepperPluginInfo& info);
+ bool Init(const content::PepperPluginInfo& info);
void RequestPluginChannel(Client* client);
diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc
index 12bb416..609dc8b 100644
--- a/content/common/pepper_plugin_registry.cc
+++ b/content/common/pepper_plugin_registry.cc
@@ -17,7 +17,8 @@
namespace {
// Appends any plugins from the command line to the given vector.
-void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) {
+void ComputePluginsFromCommandLine(
+ std::vector<content::PepperPluginInfo>* plugins) {
bool out_of_process =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kPpapiOutOfProcess);
const std::string value =
@@ -45,7 +46,7 @@ void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) {
std::vector<std::string> name_parts;
base::SplitString(parts[0], '#', &name_parts);
- PepperPluginInfo plugin;
+ content::PepperPluginInfo plugin;
plugin.is_out_of_process = out_of_process;
#if defined(OS_WIN)
// This means we can't provide plugins from non-ASCII paths, but
@@ -74,7 +75,7 @@ void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) {
} // namespace
-webkit::WebPluginInfo PepperPluginInfo::ToWebPluginInfo() const {
+webkit::WebPluginInfo content::PepperPluginInfo::ToWebPluginInfo() const {
webkit::WebPluginInfo info;
info.type = is_out_of_process ?
@@ -91,16 +92,8 @@ webkit::WebPluginInfo PepperPluginInfo::ToWebPluginInfo() const {
return info;
}
-PepperPluginInfo::PepperPluginInfo()
- : is_internal(false),
- is_out_of_process(false) {
-}
-
-PepperPluginInfo::~PepperPluginInfo() {
-}
-
bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info,
- PepperPluginInfo* pepper_info) {
+ content::PepperPluginInfo* pepper_info) {
if (!webkit::IsPepperPlugin(webplugin_info))
return false;
@@ -127,14 +120,15 @@ PepperPluginRegistry* PepperPluginRegistry::GetInstance() {
}
// static
-void PepperPluginRegistry::ComputeList(std::vector<PepperPluginInfo>* plugins) {
+void PepperPluginRegistry::ComputeList(
+ std::vector<content::PepperPluginInfo>* plugins) {
content::GetContentClient()->AddPepperPlugins(plugins);
ComputePluginsFromCommandLine(plugins);
}
// static
void PepperPluginRegistry::PreloadModules() {
- std::vector<PepperPluginInfo> plugins;
+ std::vector<content::PepperPluginInfo> plugins;
ComputeList(&plugins);
for (size_t i = 0; i < plugins.size(); ++i) {
if (!plugins[i].is_internal) {
@@ -148,7 +142,7 @@ void PepperPluginRegistry::PreloadModules() {
}
}
-const PepperPluginInfo* PepperPluginRegistry::GetInfoForPlugin(
+const content::PepperPluginInfo* PepperPluginRegistry::GetInfoForPlugin(
const webkit::WebPluginInfo& info) {
for (size_t i = 0; i < plugin_list_.size(); ++i) {
if (info.path == plugin_list_[i].path)
@@ -159,7 +153,7 @@ const PepperPluginInfo* PepperPluginRegistry::GetInfoForPlugin(
// is actually in |info| and we can use it to construct it and add it to
// the list. This same deal needs to be done in the browser side in
// PluginService.
- PepperPluginInfo plugin;
+ content::PepperPluginInfo plugin;
if (!MakePepperPluginInfo(info, &plugin))
return NULL;
@@ -215,7 +209,7 @@ PepperPluginRegistry::PepperPluginRegistry() {
// the initialized module, it will still try to unregister itself in its
// destructor.
for (size_t i = 0; i < plugin_list_.size(); i++) {
- const PepperPluginInfo& current = plugin_list_[i];
+ const content::PepperPluginInfo& current = plugin_list_[i];
if (current.is_out_of_process)
continue; // Out of process plugins need no special pre-initialization.
diff --git a/content/common/pepper_plugin_registry.h b/content/common/pepper_plugin_registry.h
index 4f29402..922a6e0 100644
--- a/content/common/pepper_plugin_registry.h
+++ b/content/common/pepper_plugin_registry.h
@@ -8,46 +8,15 @@
#include <list>
#include <map>
-#include <string>
-#include <vector>
-#include "base/file_path.h"
-#include "content/common/content_export.h"
+#include "content/public/common/pepper_plugin_info.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/webplugininfo.h"
-
-struct CONTENT_EXPORT PepperPluginInfo {
- PepperPluginInfo();
- ~PepperPluginInfo();
-
- webkit::WebPluginInfo ToWebPluginInfo() const;
-
- // Indicates internal plugins for which there's not actually a library.
- // These plugins are implemented in the Chrome binary using a separate set
- // of entry points (see internal_entry_points below).
- // Defaults to false.
- bool is_internal;
-
- // True when this plugin should be run out of process. Defaults to false.
- bool is_out_of_process;
-
- FilePath path; // Internal plugins have "internal-[name]" as path.
- std::string name;
- std::string description;
- std::string version;
- std::vector<webkit::WebPluginMimeType> mime_types;
-
- // When is_internal is set, this contains the function pointers to the
- // entry points for the internal plugins.
- webkit::ppapi::PluginModule::EntryPoints internal_entry_points;
-};
// Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if
// the operation is not possible, in particular the WebPluginInfo::type
// must be one of the pepper types.
bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info,
- PepperPluginInfo* pepper_info);
+ content::PepperPluginInfo* pepper_info);
// This class holds references to all of the known pepper plugin modules.
//
@@ -68,7 +37,7 @@ class PepperPluginRegistry
// plugin list every time it is called. Generally, code in the registry should
// be using the cached plugin_list_ instead.
CONTENT_EXPORT static void ComputeList(
- std::vector<PepperPluginInfo>* plugins);
+ std::vector<content::PepperPluginInfo>* plugins);
// Loads the (native) libraries but does not initialize them (i.e., does not
// call PPP_InitializeModule). This is needed by the zygote on Linux to get
@@ -79,7 +48,7 @@ class PepperPluginRegistry
// return value will be NULL if there is no such plugin.
//
// The returned pointer is owned by the PluginRegistry.
- const PepperPluginInfo* GetInfoForPlugin(
+ const content::PepperPluginInfo* GetInfoForPlugin(
const webkit::WebPluginInfo& info);
// Returns an existing loaded module for the given path. It will search for
@@ -101,7 +70,7 @@ class PepperPluginRegistry
PepperPluginRegistry();
// All known pepper plugins.
- std::vector<PepperPluginInfo> plugin_list_;
+ std::vector<content::PepperPluginInfo> plugin_list_;
// Plugins that have been preloaded so they can be executed in-process in
// the renderer (the sandbox prevents on-demand loading).
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 10e29f59..90b9c60 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -39,6 +39,8 @@
'public/common/page_transition_types.cc',
'public/common/page_transition_types.h',
'public/common/page_type.h',
+ 'public/common/pepper_plugin_info.cc',
+ 'public/common/pepper_plugin_info.h',
'public/common/resource_dispatcher_delegate.h',
'public/common/security_style.h',
'public/common/url_constants.cc',
diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h
index 1e4f865..7386ef7 100644
--- a/content/public/common/content_client.h
+++ b/content/public/common/content_client.h
@@ -16,7 +16,6 @@
class CommandLine;
class GURL;
-struct PepperPluginInfo;
namespace IPC {
class Message;
@@ -38,6 +37,7 @@ class ContentPluginClient;
class ContentRendererClient;
class ContentUtilityClient;
struct GPUInfo;
+struct PepperPluginInfo;
// Setter and getter for the client. The client should be set early, before any
// content code is called.
@@ -76,7 +76,8 @@ class CONTENT_EXPORT ContentClient {
virtual void SetGpuInfo(const content::GPUInfo& gpu_info) = 0;
// Gives the embedder a chance to register its own pepper plugins.
- virtual void AddPepperPlugins(std::vector<PepperPluginInfo>* plugins) = 0;
+ virtual void AddPepperPlugins(
+ std::vector<content::PepperPluginInfo>* plugins) = 0;
// Returns whether the given message should be allowed to be sent from a
// swapped out renderer.
diff --git a/content/public/common/pepper_plugin_info.cc b/content/public/common/pepper_plugin_info.cc
new file mode 100644
index 0000000..82b6c61
--- /dev/null
+++ b/content/public/common/pepper_plugin_info.cc
@@ -0,0 +1,17 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/common/pepper_plugin_info.h"
+
+namespace content {
+
+PepperPluginInfo::PepperPluginInfo()
+ : is_internal(false),
+ is_out_of_process(false) {
+}
+
+PepperPluginInfo::~PepperPluginInfo() {
+}
+
+} // namespace content
diff --git a/content/public/common/pepper_plugin_info.h b/content/public/common/pepper_plugin_info.h
new file mode 100644
index 0000000..01c8c23
--- /dev/null
+++ b/content/public/common/pepper_plugin_info.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_COMMON_PEPPER_PLUGIN_INFO_H_
+#define CONTENT_PUBLIC_COMMON_PEPPER_PLUGIN_INFO_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/file_path.h"
+#include "content/common/content_export.h"
+#include "webkit/plugins/ppapi/plugin_module.h"
+#include "webkit/plugins/webplugininfo.h"
+
+namespace content {
+
+struct CONTENT_EXPORT PepperPluginInfo {
+ PepperPluginInfo();
+ ~PepperPluginInfo();
+
+ webkit::WebPluginInfo ToWebPluginInfo() const;
+
+ // Indicates internal plugins for which there's not actually a library.
+ // These plugins are implemented in the Chrome binary using a separate set
+ // of entry points (see internal_entry_points below).
+ // Defaults to false.
+ bool is_internal;
+
+ // True when this plugin should be run out of process. Defaults to false.
+ bool is_out_of_process;
+
+ FilePath path; // Internal plugins have "internal-[name]" as path.
+ std::string name;
+ std::string description;
+ std::string version;
+ std::vector<webkit::WebPluginMimeType> mime_types;
+
+ // When is_internal is set, this contains the function pointers to the
+ // entry points for the internal plugins.
+ webkit::ppapi::PluginModule::EntryPoints internal_entry_points;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_PEPPER_PLUGIN_INFO_H_
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index 15c5398..0dd156d 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -694,7 +694,7 @@ PepperPluginDelegateImpl::CreatePepperPluginModule(
// In-process plugins will have always been created up-front to avoid the
// sandbox restrictions. So getting here implies it doesn't exist or should
// be out of process.
- const PepperPluginInfo* info =
+ const content::PepperPluginInfo* info =
PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info);
if (!info) {
*pepper_plugin_was_registered = false;
diff --git a/content/shell/shell_content_client.cc b/content/shell/shell_content_client.cc
index 5caaef0..bc98458 100644
--- a/content/shell/shell_content_client.cc
+++ b/content/shell/shell_content_client.cc
@@ -19,7 +19,7 @@ void ShellContentClient::SetGpuInfo(const GPUInfo& gpu_info) {
}
void ShellContentClient::AddPepperPlugins(
- std::vector<PepperPluginInfo>* plugins) {
+ std::vector<content::PepperPluginInfo>* plugins) {
}
bool ShellContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
diff --git a/content/shell/shell_content_client.h b/content/shell/shell_content_client.h
index 767241e..8494e99 100644
--- a/content/shell/shell_content_client.h
+++ b/content/shell/shell_content_client.h
@@ -18,7 +18,7 @@ class ShellContentClient : public ContentClient {
virtual void SetActiveURL(const GURL& url) OVERRIDE;
virtual void SetGpuInfo(const GPUInfo& gpu_info) OVERRIDE;
virtual void AddPepperPlugins(
- std::vector<PepperPluginInfo>* plugins) OVERRIDE;
+ std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent(bool* overriding) const OVERRIDE;
diff --git a/content/test/test_content_client.cc b/content/test/test_content_client.cc
index 82818cc..7f329f1 100644
--- a/content/test/test_content_client.cc
+++ b/content/test/test_content_client.cc
@@ -20,7 +20,7 @@ void TestContentClient::SetGpuInfo(const content::GPUInfo& gpu_info) {
}
void TestContentClient::AddPepperPlugins(
- std::vector<PepperPluginInfo>* plugins) {
+ std::vector<content::PepperPluginInfo>* plugins) {
}
bool TestContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
diff --git a/content/test/test_content_client.h b/content/test/test_content_client.h
index 4423263..0506b08 100644
--- a/content/test/test_content_client.h
+++ b/content/test/test_content_client.h
@@ -18,7 +18,7 @@ class TestContentClient : public content::ContentClient {
virtual void SetActiveURL(const GURL& url) OVERRIDE;
virtual void SetGpuInfo(const content::GPUInfo& gpu_info) OVERRIDE;
virtual void AddPepperPlugins(
- std::vector<PepperPluginInfo>* plugins) OVERRIDE;
+ std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent(bool* overriding) const OVERRIDE;