Index: webkit/glue/plugins/plugin_group.cc |
diff --git a/webkit/glue/plugins/plugin_group.cc b/webkit/glue/plugins/plugin_group.cc |
index 625ef3cbf2e7709ca44f1766da813bfeb45830d6..96cbb05177a98d1190d4eef36889c8cdc4825ce4 100644 |
--- a/webkit/glue/plugins/plugin_group.cc |
+++ b/webkit/glue/plugins/plugin_group.cc |
@@ -99,25 +99,22 @@ PluginGroup::PluginGroup(const string16& group_name, |
name_matcher_(name_matcher), |
update_url_(update_url), |
enabled_(false), |
- version_(Version::GetVersionFromString("0")) { |
+ version_(Version::GetVersionFromString("0")), |
+ plugin_list_(NULL) { |
} |
void PluginGroup::InitFrom(const PluginGroup& other) { |
- enabled_ = false; |
identifier_ = other.identifier_; |
group_name_ = other.group_name_; |
name_matcher_ = other.name_matcher_; |
+ description_ = other.description_; |
update_url_ = other.update_url_; |
- for (size_t i = 0; i < other.version_ranges_.size(); ++i) |
- version_ranges_.push_back(other.version_ranges_[i]); |
- DCHECK_EQ(other.web_plugin_infos_.size(), other.web_plugin_positions_.size()); |
- std::list<WebPluginInfo>::const_iterator it = other.web_plugin_infos_.begin(); |
- std::vector<int>::const_iterator itprio = other.web_plugin_positions_.begin(); |
- for (; it != other.web_plugin_infos_.end(); ++it, ++itprio) |
- AddPlugin(*it, *itprio, NULL); |
- if (!version_.get()) |
- version_.reset(Version::GetVersionFromString("0")); |
enabled_ = other.enabled_; |
+ version_ranges_ = other.version_ranges_; |
+ version_.reset(other.version_->Clone()); |
+ web_plugin_infos_ = other.web_plugin_infos_; |
+ web_plugin_positions_ = other.web_plugin_positions_; |
+ plugin_list_ = other.plugin_list_; |
} |
PluginGroup::PluginGroup(const PluginGroup& other) { |
@@ -125,7 +122,6 @@ PluginGroup::PluginGroup(const PluginGroup& other) { |
} |
PluginGroup& PluginGroup::operator=(const PluginGroup& other) { |
- version_ranges_.clear(); |
InitFrom(other); |
return *this; |
} |
@@ -270,6 +266,10 @@ std::vector<int>& PluginGroup::GetPluginPositions() { |
return web_plugin_positions_; |
} |
+bool PluginGroup::IsEmpty() const { |
+ return web_plugin_infos_.empty(); |
+} |
+ |
string16 PluginGroup::GetGroupName() const { |
if (!group_name_.empty()) |
return group_name_; |
@@ -399,7 +399,7 @@ void PluginGroup::DisableOutdatedPlugins() { |
bool plugin_is_outdated = false; |
for (size_t i = 0; i < version_ranges_.size(); ++i) { |
if (IsPluginOutdated(*version, version_ranges_[i])) { |
- NPAPI::PluginList::Singleton()->DisablePlugin(it->path, false); |
+ GetPluginList()->DisablePlugin(it->path, false); |
plugin_is_outdated = true; |
break; |
} |
@@ -418,10 +418,10 @@ void PluginGroup::Enable(bool enable) { |
it != web_plugin_infos_.end(); ++it) { |
bool policy_disabled = IsPluginNameDisabledByPolicy(it->name); |
if (enable && !policy_disabled) { |
- NPAPI::PluginList::Singleton()->EnablePlugin(it->path); |
+ GetPluginList()->EnablePlugin(it->path); |
enabled_plugin_exists = true; |
} else { |
- NPAPI::PluginList::Singleton()->DisablePlugin(it->path, policy_disabled); |
+ GetPluginList()->DisablePlugin(it->path, policy_disabled); |
} |
} |
enabled_ = enabled_plugin_exists; |
@@ -438,3 +438,9 @@ void PluginGroup::RefreshEnabledState() { |
} |
enabled_ = enabled_plugin_exists; |
} |
+ |
+NPAPI::PluginList* PluginGroup::GetPluginList() const { |
+ if (plugin_list_) |
+ return plugin_list_; |
+ return NPAPI::PluginList::Singleton(); |
+} |