diff options
author | elijahtaylor@google.com <elijahtaylor@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 01:22:49 +0000 |
---|---|---|
committer | elijahtaylor@google.com <elijahtaylor@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 01:22:49 +0000 |
commit | aa6a39339c9811b115680c48c00f6cc955367869 (patch) | |
tree | c14413530e1b6aca5477628af93e0e304e5e0a2f /chrome/browser | |
parent | 90cf854e3e36879a17dacc01c1b17e388da40b94 (diff) | |
download | chromium_src-aa6a39339c9811b115680c48c00f6cc955367869.zip chromium_src-aa6a39339c9811b115680c48c00f6cc955367869.tar.gz chromium_src-aa6a39339c9811b115680c48c00f6cc955367869.tar.bz2 |
Add a preference to force enable the NaCl plugin as we transition to
on-by-default.
This is a mirror change of http://codereview.chromium.org/7720021/ for trunk (some files have changed so it was necessary to check into the branch and trunk separately instead of merging)
BUG=93984
TEST=manual
Review URL: http://codereview.chromium.org/7693030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/plugin_prefs.cc | 36 | ||||
-rw-r--r-- | chrome/browser/ui/webui/plugins_ui.cc | 3 |
2 files changed, 35 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. diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index 55304c3..78a3c18 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -334,6 +334,9 @@ void PluginsUI::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, false, PrefService::UNSYNCABLE_PREF); + prefs->RegisterBooleanPref(prefs::kPluginsEnabledNaCl, + false, + PrefService::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, false, PrefService::UNSYNCABLE_PREF); |