summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 19:01:47 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 19:01:47 +0000
commitfb476a2653613edf0ce08654b67df3df8dcd5bda (patch)
tree88123b9bf3f105d672abfd79c27794cbde5226cd
parenta47fa686c1a9464a97a348455a51268e002290e8 (diff)
downloadchromium_src-fb476a2653613edf0ce08654b67df3df8dcd5bda.zip
chromium_src-fb476a2653613edf0ce08654b67df3df8dcd5bda.tar.gz
chromium_src-fb476a2653613edf0ce08654b67df3df8dcd5bda.tar.bz2
Remove the two years old code to enable the nacl plugin once if it's disabled. This was added to deal with old profiles when we had the plugin disabled by default. There have been 15 releases in the meantime, which is enough chances to update this pref.
This is in preparation for moving webkit/plugins to content/. BUG=237249 R=bauerb@chromium.org Review URL: https://codereview.chromium.org/19518006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212104 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/plugins/plugin_prefs.cc74
-rw-r--r--chrome/browser/plugins/plugin_prefs.h17
-rw-r--r--chrome/browser/plugins/plugin_prefs_factory.cc4
-rw-r--r--chrome/browser/plugins/plugin_prefs_unittest.cc2
-rw-r--r--chrome/common/pref_names.cc4
-rw-r--r--chrome/common/pref_names.h1
-rw-r--r--content/browser/plugin_loader_posix.cc7
-rw-r--r--content/browser/plugin_service_impl.cc4
-rw-r--r--content/browser/plugin_service_impl.h1
-rw-r--r--content/public/browser/plugin_service.h3
10 files changed, 6 insertions, 111 deletions
diff --git a/chrome/browser/plugins/plugin_prefs.cc b/chrome/browser/plugins/plugin_prefs.cc
index 7776592..555c3fe 100644
--- a/chrome/browser/plugins/plugin_prefs.cc
+++ b/chrome/browser/plugins/plugin_prefs.cc
@@ -31,7 +31,6 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/plugin_service.h"
-#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/webplugininfo.h"
using content::BrowserThread;
@@ -39,10 +38,6 @@ using content::PluginService;
namespace {
-// How long to wait to save the plugin enabled information, which might need to
-// go to disk.
-const int64 kPluginUpdateDelayMs = 60 * 1000;
-
bool IsComponentUpdatedPepperFlash(const base::FilePath& plugin) {
if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) {
base::FilePath component_updated_pepper_flash_dir;
@@ -106,11 +101,6 @@ scoped_refptr<PluginPrefs> PluginPrefs::GetForTestingProfile(
profile, &PluginPrefsFactory::CreateForTestingProfile).get());
}
-void PluginPrefs::SetPluginListForTesting(
- webkit::npapi::PluginList* plugin_list) {
- plugin_list_ = plugin_list;
-}
-
void PluginPrefs::EnablePluginGroup(bool enabled, const string16& group_name) {
PluginService::GetInstance()->GetPlugins(
base::Bind(&PluginPrefs::EnablePluginGroupInternal,
@@ -326,24 +316,6 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
prefs::kPluginsLastInternalDirectory, cur_internal_dir);
}
- 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);
- base::FilePath nacl_path;
- PathService::Get(chrome::FILE_NACL_PLUGIN, &nacl_path);
- base::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;
- }
-
bool migrate_to_pepper_flash = false;
#if defined(OS_WIN) || defined(OS_MACOSX)
// If bundled NPAPI Flash is enabled while Pepper Flash is disabled, we
@@ -449,12 +421,7 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
}
}
- if (base::FilePath::CompareIgnoreCase(path, nacl_path_str) == 0) {
- if (!enabled && force_enable_nacl) {
- enabled = true;
- plugin->SetBoolean("enabled", true);
- }
- } else if (migrate_to_pepper_flash &&
+ if (migrate_to_pepper_flash &&
base::FilePath::CompareEqualIgnoreCase(
path, npapi_flash.value())) {
npapi_flash_enabled = enabled;
@@ -474,12 +441,6 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
plugin_state_.Set(plugin_path, enabled);
} else if (!enabled && plugin->GetString("name", &group_name)) {
- // Don't disable this group if it's for the nacl plugin and we just
- // forced it on.
- if (force_enable_nacl && (nacl_group_name == group_name ||
- old_nacl_group_name == group_name))
- continue;
-
// Otherwise this is a list of groups.
plugin_group_state_[group_name] = false;
}
@@ -498,9 +459,7 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
} 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 nacl plugin
- // again.
- force_enable_nacl = true;
+ // browser too quickly.
// Only want one PDF plugin enabled at a time. See http://crbug.com/50105
// for background.
@@ -538,17 +497,6 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
base::Unretained(this),
&policy_enabled_plugin_patterns_));
- if (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.
- BrowserThread::PostDelayedTask(
- BrowserThread::FILE,
- FROM_HERE,
- base::Bind(&PluginPrefs::GetPreferencesDataOnFileThread, this),
- base::TimeDelta::FromMilliseconds(kPluginUpdateDelayMs));
- }
-
NotifyPluginStatusChanged();
}
@@ -558,8 +506,7 @@ void PluginPrefs::ShutdownOnUIThread() {
}
PluginPrefs::PluginPrefs() : profile_(NULL),
- prefs_(NULL),
- plugin_list_(NULL) {
+ prefs_(NULL) {
}
PluginPrefs::~PluginPrefs() {
@@ -574,21 +521,6 @@ void PluginPrefs::SetPolicyEnforcedPluginPatterns(
policy_enabled_plugin_patterns_ = enabled_patterns;
}
-webkit::npapi::PluginList* PluginPrefs::GetPluginList() const {
- if (plugin_list_)
- return plugin_list_;
- return PluginService::GetInstance()->GetPluginList();
-}
-
-void PluginPrefs::GetPreferencesDataOnFileThread() {
- std::vector<webkit::WebPluginInfo> plugins;
- webkit::npapi::PluginList* plugin_list = GetPluginList();
- plugin_list->GetPluginsNoRefresh(&plugins);
-
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&PluginPrefs::OnUpdatePreferences, this, plugins));
-}
-
void PluginPrefs::OnUpdatePreferences(
const std::vector<webkit::WebPluginInfo>& plugins) {
if (!prefs_)
diff --git a/chrome/browser/plugins/plugin_prefs.h b/chrome/browser/plugins/plugin_prefs.h
index 93872f7..fd0e403 100644
--- a/chrome/browser/plugins/plugin_prefs.h
+++ b/chrome/browser/plugins/plugin_prefs.h
@@ -25,9 +25,6 @@ class ListValue;
namespace webkit {
struct WebPluginInfo;
-namespace npapi {
-class PluginList;
-}
}
// This class stores information about whether a plug-in or a plug-in group is
@@ -49,9 +46,6 @@ class PluginPrefs : public RefcountedBrowserContextKeyedService {
// created PluginPrefs object.
static scoped_refptr<PluginPrefs> GetForTestingProfile(Profile* profile);
- // Sets the plug-in list for tests.
- void SetPluginListForTesting(webkit::npapi::PluginList* plugin_list);
-
// Creates a new instance. This method should only be used for testing.
PluginPrefs();
@@ -119,9 +113,6 @@ class PluginPrefs : public RefcountedBrowserContextKeyedService {
const std::set<string16>& disabled_exception_patterns,
const std::set<string16>& enabled_patterns);
- // Returns the plugin list to use, either the singleton or the override.
- webkit::npapi::PluginList* GetPluginList() const;
-
// Callback for after the plugin groups have been loaded.
void EnablePluginGroupInternal(
bool enabled,
@@ -134,10 +125,6 @@ class PluginPrefs : public RefcountedBrowserContextKeyedService {
const base::Callback<void(bool)>& callback,
const std::vector<webkit::WebPluginInfo>& plugins);
- // Called on the file thread to get the data necessary to update the saved
- // preferences.
- void GetPreferencesDataOnFileThread();
-
// Called on the UI thread with the plugin data to save the preferences.
void OnUpdatePreferences(const std::vector<webkit::WebPluginInfo>& plugins);
@@ -167,10 +154,6 @@ class PluginPrefs : public RefcountedBrowserContextKeyedService {
// Weak pointer, owned by the profile.
PrefService* prefs_;
- // PluginList to use for testing. If this is NULL, defaults to the global
- // singleton.
- webkit::npapi::PluginList* plugin_list_;
-
PrefChangeRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(PluginPrefs);
diff --git a/chrome/browser/plugins/plugin_prefs_factory.cc b/chrome/browser/plugins/plugin_prefs_factory.cc
index 7910d68..f6b409f 100644
--- a/chrome/browser/plugins/plugin_prefs_factory.cc
+++ b/chrome/browser/plugins/plugin_prefs_factory.cc
@@ -60,10 +60,6 @@ void PluginPrefsFactory::RegisterProfilePrefs(
internal_dir,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterBooleanPref(
- prefs::kPluginsEnabledNaCl,
- false,
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterBooleanPref(
prefs::kPluginsMigratedToPepperFlash,
false,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
diff --git a/chrome/browser/plugins/plugin_prefs_unittest.cc b/chrome/browser/plugins/plugin_prefs_unittest.cc
index 66e8a47..805246b 100644
--- a/chrome/browser/plugins/plugin_prefs_unittest.cc
+++ b/chrome/browser/plugins/plugin_prefs_unittest.cc
@@ -185,7 +185,6 @@ TEST_F(PluginPrefsTest, UnifiedPepperFlashState) {
webkit::npapi::MockPluginList plugin_list;
PluginService::GetInstance()->SetPluginListForTesting(&plugin_list);
PluginService::GetInstance()->Init();
- plugin_prefs_->SetPluginListForTesting(&plugin_list);
string16 component_updated_plugin_name(
ASCIIToUTF16("Component-updated Pepper Flash"));
@@ -251,6 +250,5 @@ TEST_F(PluginPrefsTest, UnifiedPepperFlashState) {
EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2));
EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin));
- plugin_prefs_->SetPluginListForTesting(NULL);
PluginService::GetInstance()->SetPluginListForTesting(NULL);
}
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index b526eba..c4f58d4 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -990,10 +990,6 @@ const char kPluginsDisabledPluginsExceptions[] =
// List pref containing names of plugins that are enabled by policy.
const char kPluginsEnabledPlugins[] = "plugins.plugins_enabled";
-// When first shipped, the nacl plugin will be disabled by default. When we
-// enable it by default, we'll want to do so only once.
-const char kPluginsEnabledNaCl[] = "plugins.enabled_nacl";
-
// When bundled NPAPI Flash is removed, if at that point it is enabled while
// Pepper Flash is disabled, we would like to turn on Pepper Flash. And we will
// want to do so only once.
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index c81996f..7e92bfc 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -359,7 +359,6 @@ extern const char kPluginsPluginsList[];
extern const char kPluginsDisabledPlugins[];
extern const char kPluginsDisabledPluginsExceptions[];
extern const char kPluginsEnabledPlugins[];
-extern const char kPluginsEnabledNaCl[];
extern const char kPluginsMigratedToPepperFlash[];
extern const char kPluginsRemovedOldComponentPepperFlashSettings[];
extern const char kPluginsShowDetails[];
diff --git a/content/browser/plugin_loader_posix.cc b/content/browser/plugin_loader_posix.cc
index 56a6839..b33cc80 100644
--- a/content/browser/plugin_loader_posix.cc
+++ b/content/browser/plugin_loader_posix.cc
@@ -75,11 +75,11 @@ void PluginLoaderPosix::GetPluginsToLoad() {
next_load_index_ = 0;
canonical_list_.clear();
- PluginServiceImpl::GetInstance()->GetPluginList()->GetPluginPathsToLoad(
+ webkit::npapi::PluginList::Singleton()->GetPluginPathsToLoad(
&canonical_list_);
internal_plugins_.clear();
- PluginServiceImpl::GetInstance()->GetPluginList()->GetInternalPlugins(
+ webkit::npapi::PluginList::Singleton()->GetInternalPlugins(
&internal_plugins_);
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
@@ -163,8 +163,7 @@ bool PluginLoaderPosix::MaybeRunPendingCallbacks() {
if (next_load_index_ < canonical_list_.size())
return false;
- PluginServiceImpl::GetInstance()->GetPluginList()->SetPlugins(
- loaded_plugins_);
+ webkit::npapi::PluginList::Singleton()->SetPlugins(loaded_plugins_);
// Only call the first callback with loaded plugins because there may be
// some extra plugin paths added since the first callback is added.
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 89681bd..6ed78ea 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -793,8 +793,4 @@ void PluginServiceImpl::GetInternalPlugins(
plugin_list_->GetInternalPlugins(plugins);
}
-webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() {
- return plugin_list_;
-}
-
} // namespace content
diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h
index 3349672..c0528f4 100644
--- a/content/browser/plugin_service_impl.h
+++ b/content/browser/plugin_service_impl.h
@@ -108,7 +108,6 @@ class CONTENT_EXPORT PluginServiceImpl
const webkit::WebPluginInfo& info, bool add_at_beginning) OVERRIDE;
virtual void GetInternalPlugins(
std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE;
- virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE;
virtual void SetPluginListForTesting(
webkit::npapi::PluginList* plugin_list) OVERRIDE;
#if defined(OS_MACOSX)
diff --git a/content/public/browser/plugin_service.h b/content/public/browser/plugin_service.h
index c1c42f8..d1e9323 100644
--- a/content/public/browser/plugin_service.h
+++ b/content/public/browser/plugin_service.h
@@ -133,9 +133,6 @@ class PluginService {
virtual void GetInternalPlugins(
std::vector<webkit::WebPluginInfo>* plugins) = 0;
- // TODO(dpranke): This should be private.
- virtual webkit::npapi::PluginList* GetPluginList() = 0;
-
virtual void SetPluginListForTesting(
webkit::npapi::PluginList* plugin_list) = 0;