summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-11 00:43:44 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-11 00:43:44 +0000
commitf99c73ade9f93c7257e74992f2e540cb8319c1ad (patch)
tree3f5683ab851f1dceaef14a8f17fcdbac162ba84b
parent036d83894fc084e0d05cc98fcf992505800f0c8c (diff)
downloadchromium_src-f99c73ade9f93c7257e74992f2e540cb8319c1ad.zip
chromium_src-f99c73ade9f93c7257e74992f2e540cb8319c1ad.tar.gz
chromium_src-f99c73ade9f93c7257e74992f2e540cb8319c1ad.tar.bz2
glue: deprecate npapi::PluginVersionInfo
Add new entry points to RegisterInternalPlugin that take the appropriate arguments. Currently they just call into the old version of the function. I intend to remove this function completely, but NaCl still depends on the existing API, so this is the first change while I shuffle depedencies around. TEST=compiles Review URL: http://codereview.chromium.org/6161004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70972 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor_unittest.cc5
-rw-r--r--chrome/common/default_plugin.cc23
-rw-r--r--chrome/common/gpu_plugin.cc25
-rw-r--r--chrome/renderer/pepper_devices_browsertest.cc44
-rw-r--r--webkit/plugins/npapi/plugin_list.cc25
-rw-r--r--webkit/plugins/npapi/plugin_list.h10
6 files changed, 70 insertions, 62 deletions
diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
index ba84fd5..63f76cc 100644
--- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
@@ -66,10 +66,7 @@ class GViewRequestInterceptorTest : public testing::Test {
}
void RegisterPDFPlugin() {
- webkit::npapi::PluginVersionInfo info;
- info.path = pdf_path_;
- memset(&info.entry_points, 0, sizeof(info.entry_points));
- webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info);
+ webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(pdf_path_);
webkit::npapi::PluginList::Singleton()->RefreshPlugins();
}
diff --git a/chrome/common/default_plugin.cc b/chrome/common/default_plugin.cc
index 3337c7c..61bbc87 100644
--- a/chrome/common/default_plugin.cc
+++ b/chrome/common/default_plugin.cc
@@ -10,25 +10,20 @@
namespace chrome {
void RegisterInternalDefaultPlugin() {
- const webkit::npapi::PluginVersionInfo default_plugin = {
- FilePath(webkit::npapi::kDefaultPluginLibraryName),
- L"Default Plug-in",
- L"Provides functionality for installing third-party plug-ins",
- L"1",
- L"*",
- L"",
- L"",
- {
+ const webkit::npapi::PluginEntryPoints entry_points = {
#if !defined(OS_POSIX) || defined(OS_MACOSX)
- default_plugin::NP_GetEntryPoints,
+ default_plugin::NP_GetEntryPoints,
#endif
- default_plugin::NP_Initialize,
- default_plugin::NP_Shutdown
- }
+ default_plugin::NP_Initialize,
+ default_plugin::NP_Shutdown
};
webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
- default_plugin);
+ FilePath(webkit::npapi::kDefaultPluginLibraryName),
+ "Default Plug-in",
+ "Provides functionality for installing third-party plug-ins",
+ "*",
+ entry_points);
}
} // namespace chrome
diff --git a/chrome/common/gpu_plugin.cc b/chrome/common/gpu_plugin.cc
index 4600638..fd4c680 100644
--- a/chrome/common/gpu_plugin.cc
+++ b/chrome/common/gpu_plugin.cc
@@ -15,28 +15,21 @@ namespace chrome {
void RegisterInternalGPUPlugin() {
#if defined(ENABLE_GPU)
- static const std::wstring kWideMimeType = ASCIIToWide(
- "application/vnd.google.chrome.gpu-plugin");
- static const webkit::npapi::PluginVersionInfo kGPUPluginInfo = {
- FilePath(FILE_PATH_LITERAL("gpu-plugin")),
- L"GPU Plug-in",
- L"GPU Rendering Plug-in",
- L"1",
- kWideMimeType.c_str(),
- L"",
- L"",
- {
+ const webkit::npapi::PluginEntryPoints entry_points = {
#if !defined(OS_POSIX) || defined(OS_MACOSX)
- gpu_plugin::NP_GetEntryPoints,
+ gpu_plugin::NP_GetEntryPoints,
#endif
- gpu_plugin::NP_Initialize,
- gpu_plugin::NP_Shutdown
- }
+ gpu_plugin::NP_Initialize,
+ gpu_plugin::NP_Shutdown
};
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableGPUPlugin))
webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
- kGPUPluginInfo);
+ FilePath(FILE_PATH_LITERAL("gpu-plugin")),
+ "GPU Plug-in",
+ "GPU Rendering Plug-in",
+ "application/vnd.google.chrome.gpu-plugin",
+ entry_points);
#endif // ENABLE_GPU
}
diff --git a/chrome/renderer/pepper_devices_browsertest.cc b/chrome/renderer/pepper_devices_browsertest.cc
index 963975c..37fd12a 100644
--- a/chrome/renderer/pepper_devices_browsertest.cc
+++ b/chrome/renderer/pepper_devices_browsertest.cc
@@ -26,6 +26,8 @@ class PepperDeviceTest;
namespace {
+const FilePath::CharType kTestPluginFileName[] =
+ FILE_PATH_LITERAL("pepper-device-tester");
const char kTestPluginMimeType[] = "chrome-test/pepper-device-test";
// This maps the NPP instances to the test object so our C callbacks can easily
@@ -102,11 +104,6 @@ NPError API_CALL NP_Shutdown() {
class PepperDeviceTest : public RenderViewTest {
public:
- PepperDeviceTest();
- ~PepperDeviceTest();
-
- const FilePath& plugin_path() const { return version_info_.path; }
-
WebPluginDelegatePepper* pepper_plugin() const { return pepper_plugin_; }
NPP npp() const { return pepper_plugin_->instance()->npp(); }
@@ -135,35 +132,26 @@ class PepperDeviceTest : public RenderViewTest {
virtual void SetUp();
virtual void TearDown();
- webkit::npapi::PluginVersionInfo version_info_;
-
scoped_ptr<webkit::npapi::WebPluginImpl> plugin_;
WebPluginDelegatePepper* pepper_plugin_; // FIXME(brettw): check lifetime.
};
-PepperDeviceTest::PepperDeviceTest() {
- version_info_.path = FilePath(FILE_PATH_LITERAL("pepper-device-tester"));
- version_info_.product_name = ASCIIToWide("Pepper device test plugin");
- version_info_.file_description = ASCIIToWide("Pepper device test plugin");
- version_info_.file_version = ASCIIToWide("1");
- version_info_.mime_types = ASCIIToWide(kTestPluginMimeType);
+void PepperDeviceTest::SetUp() {
+ RenderViewTest::SetUp();
+
webkit::npapi::PluginEntryPoints entry_points = {
#if !defined(OS_POSIX) || defined(OS_MACOSX)
- NP_GetEntryPoints,
+ NP_GetEntryPoints,
#endif
- NP_Initialize,
- NP_Shutdown
+ NP_Initialize,
+ NP_Shutdown
};
- version_info_.entry_points = entry_points;
-}
-
-PepperDeviceTest::~PepperDeviceTest() {
-}
-
-void PepperDeviceTest::SetUp() {
- RenderViewTest::SetUp();
-
- webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(version_info_);
+ webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
+ FilePath(kTestPluginFileName),
+ "Pepper device test plugin",
+ "Pepper device test plugin",
+ kTestPluginMimeType,
+ entry_points);
// Create the WebKit plugin with no delegates (this seems to work
// sufficiently for the test).
@@ -174,7 +162,7 @@ void PepperDeviceTest::SetUp() {
// Create a pepper plugin for the RenderView.
pepper_plugin_ = WebPluginDelegatePepper::Create(
- plugin_path(), kTestPluginMimeType, view_->AsWeakPtr());
+ FilePath(kTestPluginFileName), kTestPluginMimeType, view_->AsWeakPtr());
ASSERT_TRUE(pepper_plugin_);
ASSERT_TRUE(pepper_plugin_->Initialize(GURL(), std::vector<std::string>(),
std::vector<std::string>(),
@@ -202,7 +190,7 @@ void PepperDeviceTest::TearDown() {
pepper_plugin_->PluginDestroyed();
webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(
- version_info_.path);
+ FilePath(kTestPluginFileName));
RenderViewTest::TearDown();
}
diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc
index 766199e..b2598a7 100644
--- a/webkit/plugins/npapi/plugin_list.cc
+++ b/webkit/plugins/npapi/plugin_list.cc
@@ -225,6 +225,31 @@ void PluginList::RegisterInternalPlugin(const PluginVersionInfo& info) {
internal_plugins_.push_back(info);
}
+void PluginList::RegisterInternalPlugin(const FilePath& path) {
+ webkit::npapi::PluginVersionInfo info;
+ info.path = path;
+ memset(&info.entry_points, 0, sizeof(info.entry_points));
+ RegisterInternalPlugin(info);
+}
+
+void PluginList::RegisterInternalPlugin(const FilePath& filename,
+ const std::string& name,
+ const std::string& description,
+ const std::string& mime_type,
+ const PluginEntryPoints& entry_points) {
+ webkit::npapi::PluginVersionInfo info = {
+ filename,
+ ASCIIToWide(name),
+ ASCIIToWide(description),
+ L"1",
+ ASCIIToWide(mime_type),
+ L"",
+ L"",
+ entry_points
+ };
+ RegisterInternalPlugin(info);
+}
+
void PluginList::UnregisterInternalPlugin(const FilePath& path) {
AutoLock lock(lock_);
for (size_t i = 0; i < internal_plugins_.size(); i++) {
diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h
index 94124a2..553b554 100644
--- a/webkit/plugins/npapi/plugin_list.h
+++ b/webkit/plugins/npapi/plugin_list.h
@@ -47,6 +47,7 @@ struct PluginEntryPoints {
// the version info of the dll; For internal plugins, it's predefined and
// includes addresses of entry functions. (Yes, it's Win32 NPAPI-centric, but
// it'll do for holding descriptions of internal plugins cross-platform.)
+// TODO(evan): remove when NaCl is fixed.
struct PluginVersionInfo {
FilePath path;
// Info about the plugin itself.
@@ -99,6 +100,15 @@ class PluginList {
// Register an internal plugin with the specified plugin information and
// function pointers. An internal plugin must be registered before it can
// be loaded using PluginList::LoadPlugin().
+ void RegisterInternalPlugin(const FilePath& path);
+ void RegisterInternalPlugin(const FilePath& filename,
+ const std::string& name,
+ const std::string& description,
+ const std::string& mime_type,
+ const PluginEntryPoints& entry_points);
+
+ // Deprecated version of the above.
+ // TODO(evan): remove when NaCl is fixed.
void RegisterInternalPlugin(const PluginVersionInfo& info);
// Removes a specified internal plugin from the list. The search will match