summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_prefs.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/plugin_prefs.cc')
-rw-r--r--chrome/browser/plugin_prefs.cc36
1 files changed, 32 insertions, 4 deletions
diff --git a/chrome/browser/plugin_prefs.cc b/chrome/browser/plugin_prefs.cc
index 2a1e3d0..9af4c67 100644
--- a/chrome/browser/plugin_prefs.cc
+++ b/chrome/browser/plugin_prefs.cc
@@ -210,6 +210,24 @@ void PluginPrefs::SetProfile(Profile* profile) {
force_enable_internal_pdf = true;
}
+ bool force_enable_nacl = false;
+ string16 nacl_group_name =
+ ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName);
+ // Since the NaCl Plugin changed names between Chrome 13 and 14, we need to
+ // check for both because either could be stored as the plugin group name.
+ string16 old_nacl_group_name =
+ ASCIIToUTF16(chrome::ChromeContentClient::kNaClOldPluginName);
+ FilePath nacl_path;
+ PathService::Get(chrome::FILE_NACL_PLUGIN, &nacl_path);
+ FilePath::StringType nacl_path_str = nacl_path.value();
+ if (!prefs_->GetBoolean(prefs::kPluginsEnabledNaCl)) {
+ // We switched to the nacl plugin being on by default, and so we need to
+ // force it to be enabled. We only want to do it this once though, i.e.
+ // we don't want to enable it again if the user disables it afterwards.
+ prefs_->SetBoolean(prefs::kPluginsEnabledNaCl, true);
+ force_enable_nacl = true;
+ }
+
{ // Scoped update of prefs::kPluginsPluginsList.
ListPrefUpdate update(prefs_, prefs::kPluginsPluginsList);
ListValue* saved_plugins_list = update.Get();
@@ -251,15 +269,23 @@ void PluginPrefs::SetProfile(Profile* profile) {
}
internal_pdf_enabled = enabled;
+ } else if (FilePath::CompareIgnoreCase(path, nacl_path_str) == 0) {
+ if (!enabled && force_enable_nacl) {
+ enabled = true;
+ plugin->SetBoolean("enabled", true);
+ }
}
if (!enabled)
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.
+ // Don't disable this group if it's for the pdf or nacl plugins and
+ // we just forced it on.
if (force_enable_internal_pdf && pdf_group_name == group_name)
continue;
+ if (force_enable_nacl && (nacl_group_name == group_name ||
+ old_nacl_group_name == group_name))
+ continue;
// Otherwise this is a list of groups.
EnablePluginGroup(false, group_name);
@@ -268,8 +294,10 @@ void PluginPrefs::SetProfile(Profile* profile) {
} else {
// If the saved plugin list is empty, then the call to UpdatePreferences()
// below failed in an earlier run, possibly because the user closed the
- // browser too quickly. Try to force enable the internal PDF plugin again.
+ // browser too quickly. Try to force enable the internal PDF and nacl
+ // plugins again.
force_enable_internal_pdf = true;
+ force_enable_nacl = true;
}
} // Scoped update of prefs::kPluginsPluginsList.
@@ -297,7 +325,7 @@ void PluginPrefs::SetProfile(Profile* profile) {
webkit::npapi::PluginGroup::kAdobeReaderGroupName));
}
- if (force_enable_internal_pdf) {
+ if (force_enable_internal_pdf || force_enable_nacl) {
// We want to save this, but doing so requires loading the list of plugins,
// so do it after a minute as to not impact startup performance. Note that
// plugins are loaded after 30s by the metrics service.