| Index: webkit/glue/plugins/plugin_group.cc
|
| diff --git a/webkit/glue/plugins/plugin_group.cc b/webkit/glue/plugins/plugin_group.cc
|
| index 723a31da2d4d44c19779d40281a212a1aa6f7481..e988fa76ebf49fbe04a7e3163c8c466c46600a8e 100644
|
| --- a/webkit/glue/plugins/plugin_group.cc
|
| +++ b/webkit/glue/plugins/plugin_group.cc
|
| @@ -233,20 +233,29 @@ void PluginGroup::UpdateDescriptionAndVersion(const WebPluginInfo& plugin) {
|
| version_.reset(Version::GetVersionFromString("0"));
|
| }
|
|
|
| -void PluginGroup::AddPlugin(const WebPluginInfo& plugin, int position) {
|
| +bool PluginGroup::AddPlugin(const WebPluginInfo& plugin, int position) {
|
| // Check if this group already contains this plugin.
|
| for (size_t i = 0; i < web_plugin_infos_.size(); ++i) {
|
| if (web_plugin_infos_[i].name == plugin.name &&
|
| web_plugin_infos_[i].version == plugin.version &&
|
| FilePath::CompareEqualIgnoreCase(web_plugin_infos_[i].path.value(),
|
| plugin.path.value())) {
|
| - return;
|
| + return false;
|
| }
|
| }
|
| web_plugin_infos_.push_back(plugin);
|
| // The position of this plugin relative to the global list of plugins.
|
| web_plugin_positions_.push_back(position);
|
| UpdateActivePlugin(plugin);
|
| + return true;
|
| +}
|
| +
|
| +std::vector<WebPluginInfo>& PluginGroup::GetPlugins() {
|
| + return web_plugin_infos_;
|
| +}
|
| +
|
| +std::vector<int>& PluginGroup::GetPluginPositions() {
|
| + return web_plugin_positions_;
|
| }
|
|
|
| string16 PluginGroup::GetGroupName() const {
|
| @@ -367,6 +376,7 @@ bool PluginGroup::IsVulnerable() const {
|
| }
|
|
|
| void PluginGroup::DisableOutdatedPlugins() {
|
| + bool first_enabled = true;
|
| description_ = string16();
|
| enabled_ = false;
|
|
|
| @@ -377,12 +387,13 @@ void PluginGroup::DisableOutdatedPlugins() {
|
| if (version.get()) {
|
| for (size_t i = 0; i < version_ranges_.size(); ++i) {
|
| if (IsPluginOutdated(*version, version_ranges_[i])) {
|
| - it->enabled = false;
|
| - NPAPI::PluginList::Singleton()->DisablePlugin(it->path);
|
| + NPAPI::PluginList::Singleton()->DisablePlugin(it->path, false);
|
| + } else if (first_enabled) {
|
| + UpdateDescriptionAndVersion(*it);
|
| + first_enabled = false;
|
| }
|
| }
|
| }
|
| - UpdateActivePlugin(*it);
|
| }
|
| }
|
|
|
| @@ -391,13 +402,25 @@ void PluginGroup::Enable(bool enable) {
|
| for (std::vector<WebPluginInfo>::iterator it =
|
| web_plugin_infos_.begin();
|
| it != web_plugin_infos_.end(); ++it) {
|
| - if (enable && !IsPluginNameDisabledByPolicy(it->name)) {
|
| + bool policy_disabled = IsPluginNameDisabledByPolicy(it->name);
|
| + if (enable && !policy_disabled) {
|
| NPAPI::PluginList::Singleton()->EnablePlugin(it->path);
|
| - it->enabled = true;
|
| enabled_plugin_exists = true;
|
| } else {
|
| - it->enabled = false;
|
| - NPAPI::PluginList::Singleton()->DisablePlugin(it->path);
|
| + NPAPI::PluginList::Singleton()->DisablePlugin(it->path, policy_disabled);
|
| + }
|
| + }
|
| + enabled_ = enabled_plugin_exists;
|
| +}
|
| +
|
| +void PluginGroup::RefreshEnabledState() {
|
| + bool enabled_plugin_exists = false;
|
| + for (std::vector<WebPluginInfo>::iterator it =
|
| + web_plugin_infos_.begin();
|
| + it != web_plugin_infos_.end(); ++it) {
|
| + if (it->enabled) {
|
| + enabled_plugin_exists = true;
|
| + break;
|
| }
|
| }
|
| enabled_ = enabled_plugin_exists;
|
|
|