Index: webkit/glue/plugins/plugin_group.cc |
diff --git a/webkit/glue/plugins/plugin_group.cc b/webkit/glue/plugins/plugin_group.cc |
index 197466ff9b7e5cb41530d4ccc85e78fe52508a76..796c6b3478cd52098fb2e7736eb0e1ba994b9b04 100644 |
--- a/webkit/glue/plugins/plugin_group.cc |
+++ b/webkit/glue/plugins/plugin_group.cc |
@@ -99,16 +99,16 @@ 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; |
danno
2010/12/15 10:42:12
Please comment why there enabled_ flag is set twic
Jakob Kummerow
2010/12/15 18:03:27
Done. Cleaned up this whole method, it now perform
|
identifier_ = other.identifier_; |
group_name_ = other.group_name_; |
name_matcher_ = other.name_matcher_; |
- description_ = other.description_; |
update_url_ = other.update_url_; |
- enabled_ = other.enabled_; |
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()); |
@@ -118,6 +118,9 @@ void PluginGroup::InitFrom(const PluginGroup& other) { |
AddPlugin(*it, *itprio); |
if (!version_.get()) |
version_.reset(Version::GetVersionFromString("0")); |
+ DCHECK_EQ(0, version_->CompareTo(*other.version_)); |
+ plugin_list_ = other.plugin_list_; |
+ enabled_ = other.enabled_; |
} |
PluginGroup::PluginGroup(const PluginGroup& other) { |
@@ -264,6 +267,10 @@ std::vector<int>& PluginGroup::GetPluginPositions() { |
return web_plugin_positions_; |
} |
+bool PluginGroup::IsEmpty() { |
+ return web_plugin_infos_.empty(); |
+} |
+ |
string16 PluginGroup::GetGroupName() const { |
if (!group_name_.empty()) |
return group_name_; |
@@ -393,7 +400,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; |
} |
@@ -412,10 +419,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; |
@@ -432,3 +439,9 @@ void PluginGroup::RefreshEnabledState() { |
} |
enabled_ = enabled_plugin_exists; |
} |
+ |
+NPAPI::PluginList* PluginGroup::GetPluginList() { |
danno
2010/12/15 10:42:12
I think you might be better served by making this
Jakob Kummerow
2010/12/15 18:03:27
As discussed offline: Good plan, but would require
|
+ if (plugin_list_) |
+ return plugin_list_; |
+ return NPAPI::PluginList::Singleton(); |
+} |