Chromium Code Reviews| Index: chrome/browser/plugin_updater.cc |
| diff --git a/chrome/browser/plugin_updater.cc b/chrome/browser/plugin_updater.cc |
| index 40f3be1ec48c20c2e04b21a989f870a84cafeda7..5321e61194c527f1dcb67dc51290579451c7e7ff 100644 |
| --- a/chrome/browser/plugin_updater.cc |
| +++ b/chrome/browser/plugin_updater.cc |
| @@ -63,13 +63,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 && !PluginGroup::IsPluginPathDisabledByPolicy(file_path)) |
| - NPAPI::PluginList::Singleton()->EnablePlugin(file_path); |
| + if (enable) |
| + NPAPI::PluginList::Singleton()->EnablePlugin(file_path, name); |
| else |
| - NPAPI::PluginList::Singleton()->DisablePlugin(file_path); |
| + NPAPI::PluginList::Singleton()->DisablePlugin(file_path, name); |
| NotifyPluginStatusChanged(); |
| } |
| @@ -189,8 +190,11 @@ void PluginUpdater::DisablePluginGroupsFromPrefs(Profile* profile) { |
| } |
| } |
| } |
| - if (!enabled) |
| - NPAPI::PluginList::Singleton()->DisablePlugin(plugin_path); |
| + if (!enabled) { |
| + string16 name; |
| + plugin->GetString("name", &name); |
| + 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. |
| @@ -213,7 +217,7 @@ 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. |
| - NPAPI::PluginList::Singleton()->DisablePlugin(pdf_path); |
| + NPAPI::PluginList::Singleton()->DisablePlugin(pdf_path, pdf_group_name); |
| EnablePluginGroup(false, pdf_group_name); |
| } |
| @@ -246,9 +250,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( |
| @@ -268,12 +272,25 @@ void PluginUpdater::OnUpdatePreferences( |
| for (std::vector<WebPluginInfo>::const_iterator it = plugins.begin(); |
| it != plugins.end(); |
| ++it) { |
| - plugins_list->Append(CreatePluginFileSummary(*it)); |
| + DictionaryValue* summary = CreatePluginFileSummary(*it); |
| + // If the plugin is disabled only by policy don't store this state in the |
| + // user pref store. |
| + if (!it->IsEnabled() && it->reason == 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()); |
| + for (std::vector<PluginGroup>::const_iterator it = groups.begin(); |
|
jam
2010/12/17 19:14:45
the old code using a size_t instead of an iterator
pastarmovj
2010/12/20 19:57:37
Done.
|
| + it != groups.end(); |
| + ++it) { |
| + DictionaryValue* summary = it->GetSummary(); |
| + // If the plugin is disabled only by policy don't store this state in the |
| + // user pref store. |
| + if (!it->Enabled() && |
| + PluginGroup::IsPluginNameDisabledByPolicy(it->GetGroupName())) |
| + summary->SetBoolean("enabled", true); |
| + plugins_list->Append(summary); |
| } |
| } |