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

Unified Diff: chrome/browser/plugin_updater.cc

Issue 7720021: Add a preference to force enable the NaCl plugin as we transition to (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 4 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 | « no previous file | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698