Index: chrome/browser/plugin_updater.cc |
diff --git a/chrome/browser/plugin_updater.cc b/chrome/browser/plugin_updater.cc |
index d994efd305d049747337a91412e6e4842d3c804f..6ea3ecf5fe2ac0bd4aa6b744bbf4c78a7895ceda 100644 |
--- a/chrome/browser/plugin_updater.cc |
+++ b/chrome/browser/plugin_updater.cc |
@@ -64,14 +64,14 @@ void PluginUpdater::EnablePluginGroup(bool enable, const string16& group_name) { |
NotifyPluginStatusChanged(); |
} |
-void PluginUpdater::EnablePluginFile(bool enable, |
- const FilePath::StringType& path) { |
+void PluginUpdater::EnablePlugin(bool enable, |
+ const FilePath::StringType& path, |
+ const string16& name) { |
FilePath file_path(path); |
- if (enable && |
- !webkit::npapi::PluginGroup::IsPluginPathDisabledByPolicy(file_path)) |
- webkit::npapi::PluginList::Singleton()->EnablePlugin(file_path); |
+ if (enable) |
+ webkit::npapi::PluginList::Singleton()->EnablePlugin(file_path, name); |
else |
- webkit::npapi::PluginList::Singleton()->DisablePlugin(file_path); |
+ webkit::npapi::PluginList::Singleton()->DisablePlugin(file_path, name); |
NotifyPluginStatusChanged(); |
} |
@@ -192,8 +192,12 @@ void PluginUpdater::DisablePluginGroupsFromPrefs(Profile* profile) { |
} |
} |
} |
- if (!enabled) |
- webkit::npapi::PluginList::Singleton()->DisablePlugin(plugin_path); |
+ if (!enabled) { |
+ string16 name; |
+ plugin->GetString("name", &name); |
+ webkit::npapi::PluginList::Singleton()->DisablePlugin(plugin_path, |
+ name); |
+ } |
} else if (!enabled && plugin->GetString("name", &group_name)) { |
// Don't disable this group if it's for the pdf plugin and we just |
// forced it on. |
@@ -216,7 +220,8 @@ void PluginUpdater::DisablePluginGroupsFromPrefs(Profile* profile) { |
!force_internal_pdf_for_this_run) { |
// The internal PDF plugin is disabled by default, and the user hasn't |
// overridden the default. |
- webkit::npapi::PluginList::Singleton()->DisablePlugin(pdf_path); |
+ webkit::npapi::PluginList::Singleton()->DisablePlugin(pdf_path, |
+ pdf_group_name); |
EnablePluginGroup(false, pdf_group_name); |
} |
@@ -250,9 +255,9 @@ void PluginUpdater::GetPreferencesDataOnFileThread(void* profile) { |
BrowserThread::PostTask( |
BrowserThread::UI, |
FROM_HERE, |
- NewRunnableFunction( |
- &PluginUpdater::OnUpdatePreferences, |
- static_cast<Profile*>(profile), plugins, groups)); |
+ NewRunnableFunction(&PluginUpdater::OnUpdatePreferences, |
+ static_cast<Profile*>(profile), |
+ plugins, groups)); |
} |
void PluginUpdater::OnUpdatePreferences( |
@@ -269,16 +274,26 @@ void PluginUpdater::OnUpdatePreferences( |
internal_dir); |
// Add the plugin files. |
- for (std::vector<webkit::npapi::WebPluginInfo>::const_iterator it = |
- plugins.begin(); |
- it != plugins.end(); |
- ++it) { |
- plugins_list->Append(CreatePluginFileSummary(*it)); |
+ for (size_t i = 0; i < plugins.size(); ++i) { |
+ DictionaryValue* summary = CreatePluginFileSummary(plugins[i]); |
+ // If the plugin is disabled only by policy don't store this state in the |
+ // user pref store. |
+ if (!webkit::npapi::WebPluginInfoUtils::IsEnabled(plugins[i]) && |
+ plugins[i].reason == webkit::npapi::WebPluginInfo::MANAGED) |
+ summary->SetBoolean("enabled", true); |
+ plugins_list->Append(summary); |
} |
// Add the groups as well. |
for (size_t i = 0; i < groups.size(); ++i) { |
- plugins_list->Append(groups[i].GetSummary()); |
+ DictionaryValue* summary = groups[i].GetSummary(); |
+ // If the plugin is disabled only by policy don't store this state in the |
+ // user pref store. |
+ if (!groups[i].Enabled() && |
+ webkit::npapi::PluginGroup::IsPluginNameDisabledByPolicy( |
+ groups[i].GetGroupName())) |
+ summary->SetBoolean("enabled", true); |
+ plugins_list->Append(summary); |
} |
} |