Index: chrome/browser/plugin_updater.cc |
=================================================================== |
--- chrome/browser/plugin_updater.cc (revision 97988) |
+++ chrome/browser/plugin_updater.cc (working copy) |
@@ -155,6 +155,24 @@ |
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 (!profile->GetPrefs()->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. |
+ profile->GetPrefs()->SetBoolean(prefs::kPluginsEnabledNaCl, true); |
+ force_enable_nacl = true; |
+ } |
+ |
{ // Scoped update of prefs::kPluginsPluginsList. |
ListPrefUpdate update(profile->GetPrefs(), prefs::kPluginsPluginsList); |
ListValue* saved_plugins_list = update.Get(); |
@@ -196,15 +214,23 @@ |
} |
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); |
@@ -213,8 +239,10 @@ |
} 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. |
@@ -242,7 +270,7 @@ |
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. |