Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Unified Diff: webkit/glue/plugins/plugin_group.cc

Issue 5783005: PluginList: Unit tests and bugfixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/plugins/plugin_group.h ('k') | webkit/glue/plugins/plugin_group_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..73d4bf2b309713f783a8c39668156c661b288077 100644
--- a/webkit/glue/plugins/plugin_group.cc
+++ b/webkit/glue/plugins/plugin_group.cc
@@ -99,7 +99,8 @@ 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) {
@@ -108,7 +109,6 @@ void PluginGroup::InitFrom(const PluginGroup& other) {
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_));
stuartmorgan 2010/12/14 16:25:29 I'm confused; you still aren't actually copying ve
Jakob Kummerow 2010/12/14 16:53:43 The call to AddPlugin(...) updates |version_|, pro
+ 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() {
+ if (plugin_list_)
+ return plugin_list_;
+ return NPAPI::PluginList::Singleton();
+}
« no previous file with comments | « webkit/glue/plugins/plugin_group.h ('k') | webkit/glue/plugins/plugin_group_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698