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

Unified Diff: chrome/browser/plugin_updater.cc

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace fixes only. Trybot happiness still applies. Created 9 years, 11 months 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 | « chrome/browser/plugin_updater.h ('k') | chrome/browser/renderer_host/buffered_resource_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugin_updater.cc
diff --git a/chrome/browser/plugin_updater.cc b/chrome/browser/plugin_updater.cc
index d994efd305d049747337a91412e6e4842d3c804f..375bf0a283f2f181b8d9305df1e4f542798003a9 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);
@@ -250,9 +247,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 +266,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);
}
}
« no previous file with comments | « chrome/browser/plugin_updater.h ('k') | chrome/browser/renderer_host/buffered_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698