Chromium Code Reviews| Index: chrome/browser/plugin_updater.cc |
| diff --git a/chrome/browser/plugin_updater.cc b/chrome/browser/plugin_updater.cc |
| index d994efd305d049747337a91412e6e4842d3c804f..f1cc44e7bc1a60385746c130d8ff38312ea74047 100644 |
| --- a/chrome/browser/plugin_updater.cc |
| +++ b/chrome/browser/plugin_updater.cc |
| @@ -40,7 +40,7 @@ DictionaryValue* PluginUpdater::CreatePluginFileSummary( |
| data->SetString("path", plugin.path.value()); |
| data->SetString("name", plugin.name); |
| data->SetString("version", plugin.version); |
| - data->SetBoolean("enabled", plugin.enabled); |
| + data->SetBoolean("enabled", webkit::npapi::IsPluginEnabled(plugin)); |
| return data; |
| } |
| @@ -58,17 +58,14 @@ ListValue* PluginUpdater::GetPluginGroupsData() { |
| } |
| void PluginUpdater::EnablePluginGroup(bool enable, const string16& group_name) { |
| - if (webkit::npapi::PluginGroup::IsPluginNameDisabledByPolicy(group_name)) |
| - enable = false; |
| webkit::npapi::PluginList::Singleton()->EnableGroup(enable, group_name); |
| NotifyPluginStatusChanged(); |
| } |
| -void PluginUpdater::EnablePluginFile(bool enable, |
| - const FilePath::StringType& path) { |
| +void PluginUpdater::EnablePlugin(bool enable, |
| + const FilePath::StringType& path) { |
| FilePath file_path(path); |
| - if (enable && |
| - !webkit::npapi::PluginGroup::IsPluginPathDisabledByPolicy(file_path)) |
| + if (enable) |
| webkit::npapi::PluginList::Singleton()->EnablePlugin(file_path); |
| else |
| webkit::npapi::PluginList::Singleton()->DisablePlugin(file_path); |
| @@ -192,8 +189,9 @@ void PluginUpdater::DisablePluginGroupsFromPrefs(Profile* profile) { |
| } |
| } |
| } |
| - if (!enabled) |
| + if (!enabled) { |
|
jam
2011/01/19 20:22:09
nit: no need to add the brace brackets, to be cons
pastarmovj
2011/01/19 23:39:17
Done.
|
| webkit::npapi::PluginList::Singleton()->DisablePlugin(plugin_path); |
| + } |
| } 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. |
| @@ -250,9 +248,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 +267,29 @@ 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 (plugins[i].enabled == |
| + webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_DISABLED) { |
| + summary->SetBoolean("enabled", true); |
| + } |
| + bool enabled_val; |
| + summary->GetBoolean("enabled", &enabled_val); |
| + 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); |
| } |
| } |