summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/npapi/plugin_list.cc
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 18:32:42 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 18:32:42 +0000
commit6c776b1b6a5e70e908dbd8ee85dfff189120db96 (patch)
tree1e87ef50f79911b90e608dd94217e33f51e9067c /webkit/plugins/npapi/plugin_list.cc
parent6d262b7050b69d715e951be1c63b31c3fa5892b0 (diff)
downloadchromium_src-6c776b1b6a5e70e908dbd8ee85dfff189120db96.zip
chromium_src-6c776b1b6a5e70e908dbd8ee85dfff189120db96.tar.gz
chromium_src-6c776b1b6a5e70e908dbd8ee85dfff189120db96.tar.bz2
Don't prepend hardcoded plugin definitions to plugin groups.
BUG=98514 TEST=PluginListTest.* Review URL: http://codereview.chromium.org/8070024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/npapi/plugin_list.cc')
-rw-r--r--webkit/plugins/npapi/plugin_list.cc34
1 files changed, 21 insertions, 13 deletions
diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc
index e323ab6..e28aa88 100644
--- a/webkit/plugins/npapi/plugin_list.cc
+++ b/webkit/plugins/npapi/plugin_list.cc
@@ -323,21 +323,28 @@ bool PluginList::ParseMimeTypes(
PluginList::PluginList()
: plugins_need_refresh_(true),
- group_definitions_(kGroupDefinitions),
- num_group_definitions_(ARRAYSIZE_UNSAFE(kGroupDefinitions)),
default_plugin_enabled_(false) {
PlatformInit();
- AddHardcodedPluginGroups(&plugin_groups_);
+ AddHardcodedPluginGroups(kGroupDefinitions,
+ ARRAYSIZE_UNSAFE(kGroupDefinitions));
}
PluginList::PluginList(const PluginGroupDefinition* definitions,
size_t num_definitions)
: plugins_need_refresh_(true),
- group_definitions_(definitions),
- num_group_definitions_(num_definitions),
default_plugin_enabled_(false) {
// Don't do platform-dependend initialization in unit tests.
- AddHardcodedPluginGroups(&plugin_groups_);
+ AddHardcodedPluginGroups(definitions, num_definitions);
+}
+
+PluginGroup* PluginList::CreatePluginGroup(
+ const webkit::WebPluginInfo& web_plugin_info) const {
+ for (size_t i = 0; i < hardcoded_plugin_groups_.size(); ++i) {
+ const PluginGroup* group = hardcoded_plugin_groups_[i];
+ if (group->Match(web_plugin_info))
+ return new PluginGroup(*group);
+ }
+ return PluginGroup::FromWebPluginInfo(web_plugin_info);
}
void PluginList::LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups) {
@@ -410,7 +417,6 @@ void PluginList::LoadPlugins() {
}
ScopedVector<PluginGroup> new_plugin_groups;
- AddHardcodedPluginGroups(&new_plugin_groups);
// Do the actual loading of the plugins.
LoadPluginsInternal(&new_plugin_groups);
@@ -636,7 +642,7 @@ PluginGroup* PluginList::GetPluginGroup(
}
}
}
- PluginGroup* group = PluginGroup::FromWebPluginInfo(web_plugin_info);
+ PluginGroup* group = CreatePluginGroup(web_plugin_info);
group->AddPlugin(web_plugin_info);
return group;
}
@@ -649,10 +655,12 @@ string16 PluginList::GetPluginGroupName(const std::string& identifier) {
return string16();
}
-void PluginList::AddHardcodedPluginGroups(ScopedVector<PluginGroup>* groups) {
- for (size_t i = 0; i < num_group_definitions_; ++i) {
- groups->push_back(
- PluginGroup::FromPluginGroupDefinition(group_definitions_[i]));
+void PluginList::AddHardcodedPluginGroups(
+ const PluginGroupDefinition* group_definitions,
+ size_t num_group_definitions) {
+ for (size_t i = 0; i < num_group_definitions; ++i) {
+ hardcoded_plugin_groups_->push_back(
+ PluginGroup::FromPluginGroupDefinition(group_definitions[i]));
}
}
@@ -667,7 +675,7 @@ PluginGroup* PluginList::AddToPluginGroups(
}
}
if (!group) {
- group = PluginGroup::FromWebPluginInfo(web_plugin_info);
+ group = CreatePluginGroup(web_plugin_info);
std::string identifier = group->identifier();
// If the identifier is not unique, use the full path. This means that we
// probably won't be able to search for this group by identifier, but at