Commit 3a3ee296 authored by thestig@chromium.org's avatar thestig@chromium.org

Cleanup: Remove dead code - PluginList::DisableOutdatedPluginGroups.

BUG=92748
TEST=none

Review URL: http://codereview.chromium.org/7649029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97008 0039d316-1c4b-4281-b951-d872f2087c98
parent 2ce2d19b
...@@ -510,23 +510,6 @@ bool PluginGroup::IsEmpty() const { ...@@ -510,23 +510,6 @@ bool PluginGroup::IsEmpty() const {
return web_plugin_infos_.empty(); return web_plugin_infos_.empty();
} }
void PluginGroup::DisableOutdatedPlugins() {
ResetGroupState();
for (size_t i = 0; i < web_plugin_infos_.size(); ++i) {
scoped_ptr<Version> version(
CreateVersionFromString(web_plugin_infos_[i].version));
if (version.get()) {
for (size_t j = 0; j < version_ranges_.size(); ++j) {
if (IsPluginOutdated(*version, version_ranges_[j])) {
Disable(&web_plugin_infos_[i], WebPluginInfo::USER_DISABLED);
break;
}
}
}
UpdateActivePlugin(web_plugin_infos_[i]);
}
}
bool PluginGroup::EnableGroup(bool enable) { bool PluginGroup::EnableGroup(bool enable) {
bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(group_name_); bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(group_name_);
bool group_enabled_by_policy = IsPluginNameEnabledByPolicy(group_name_); bool group_enabled_by_policy = IsPluginNameEnabledByPolicy(group_name_);
......
...@@ -190,10 +190,6 @@ class PluginGroup { ...@@ -190,10 +190,6 @@ class PluginGroup {
// in has disappeared from the pc (or in the process of updating). // in has disappeared from the pc (or in the process of updating).
bool IsEmpty() const; bool IsEmpty() const;
// Disables all plugins in this group that are older than the
// minimum version.
void DisableOutdatedPlugins();
// Parse a version string as used by a plug-in. This method is more lenient // Parse a version string as used by a plug-in. This method is more lenient
// in accepting weird version strings than Version::GetFromString(). // in accepting weird version strings than Version::GetFromString().
static Version* CreateVersionFromString(const string16& version_string); static Version* CreateVersionFromString(const string16& version_string);
......
...@@ -173,23 +173,6 @@ TEST_F(PluginGroupTest, PluginGroupDefinition) { ...@@ -173,23 +173,6 @@ TEST_F(PluginGroupTest, PluginGroupDefinition) {
} }
} }
TEST_F(PluginGroupTest, DisableOutdated) {
PluginGroupDefinition plugindefs[] = { kPluginDef3, kPluginDef34 };
for (size_t i = 0; i < 2; ++i) {
scoped_ptr<PluginGroup> group(PluginGroupTest::CreatePluginGroup(
plugindefs[i]));
group->AddPlugin(kPlugin3043);
group->AddPlugin(kPlugin3045);
EXPECT_EQ(ASCIIToUTF16("MyPlugin version 3.0.43"), group->description());
EXPECT_TRUE(group->IsVulnerable());
group->DisableOutdatedPlugins();
EXPECT_EQ(ASCIIToUTF16("MyPlugin version 3.0.45"), group->description());
EXPECT_FALSE(group->IsVulnerable());
}
}
TEST_F(PluginGroupTest, VersionExtraction) { TEST_F(PluginGroupTest, VersionExtraction) {
// Some real-world plugin versions (spaces, commata, parentheses, 'r', oh my) // Some real-world plugin versions (spaces, commata, parentheses, 'r', oh my)
const char* versions[][2] = { const char* versions[][2] = {
......
...@@ -321,7 +321,6 @@ bool PluginList::ParseMimeTypes( ...@@ -321,7 +321,6 @@ bool PluginList::ParseMimeTypes(
PluginList::PluginList() PluginList::PluginList()
: plugins_need_refresh_(true), : plugins_need_refresh_(true),
disable_outdated_plugins_(false),
group_definitions_(kGroupDefinitions), group_definitions_(kGroupDefinitions),
num_group_definitions_(ARRAYSIZE_UNSAFE(kGroupDefinitions)), num_group_definitions_(ARRAYSIZE_UNSAFE(kGroupDefinitions)),
default_plugin_enabled_(false) { default_plugin_enabled_(false) {
...@@ -332,7 +331,6 @@ PluginList::PluginList() ...@@ -332,7 +331,6 @@ PluginList::PluginList()
PluginList::PluginList(const PluginGroupDefinition* definitions, PluginList::PluginList(const PluginGroupDefinition* definitions,
size_t num_definitions) size_t num_definitions)
: plugins_need_refresh_(true), : plugins_need_refresh_(true),
disable_outdated_plugins_(false),
group_definitions_(definitions), group_definitions_(definitions),
num_group_definitions_(num_definitions), num_group_definitions_(num_definitions),
default_plugin_enabled_(false) { default_plugin_enabled_(false) {
...@@ -448,8 +446,6 @@ void PluginList::LoadPlugins() { ...@@ -448,8 +446,6 @@ void PluginList::LoadPlugins() {
} }
group->EnforceGroupPolicy(); group->EnforceGroupPolicy();
if (disable_outdated_plugins_)
group->DisableOutdatedPlugins();
} }
// We flush the list of prematurely disabled plugins after the load has // We flush the list of prematurely disabled plugins after the load has
// finished. If for some reason a plugin reappears on a second load it is // finished. If for some reason a plugin reappears on a second load it is
...@@ -782,10 +778,6 @@ bool PluginList::SupportsExtension(const webkit::WebPluginInfo& plugin, ...@@ -782,10 +778,6 @@ bool PluginList::SupportsExtension(const webkit::WebPluginInfo& plugin,
return false; return false;
} }
void PluginList::DisableOutdatedPluginGroups() {
disable_outdated_plugins_ = true;
}
PluginList::~PluginList() { PluginList::~PluginList() {
} }
......
...@@ -193,12 +193,6 @@ class PluginList { ...@@ -193,12 +193,6 @@ class PluginList {
// the given name, it will be enabled/disabled. // the given name, it will be enabled/disabled.
bool EnableGroup(bool enable, const string16& name); bool EnableGroup(bool enable, const string16& name);
// Disable all plugins groups that are known to be outdated, according to
// the information hardcoded in PluginGroup, to make sure that they can't
// be loaded on a web page and instead show a UI to update to the latest
// version.
void DisableOutdatedPluginGroups();
virtual ~PluginList(); virtual ~PluginList();
protected: protected:
...@@ -307,9 +301,6 @@ class PluginList { ...@@ -307,9 +301,6 @@ class PluginList {
// Holds information about internal plugins. // Holds information about internal plugins.
std::vector<InternalPlugin> internal_plugins_; std::vector<InternalPlugin> internal_plugins_;
// If set to true outdated plugins are disabled in the end of LoadPlugins.
bool disable_outdated_plugins_;
// Hardcoded plugin group definitions. // Hardcoded plugin group definitions.
const PluginGroupDefinition* const group_definitions_; const PluginGroupDefinition* const group_definitions_;
const size_t num_group_definitions_; const size_t num_group_definitions_;
......
...@@ -98,39 +98,6 @@ TEST_F(PluginListTest, EmptyGroup) { ...@@ -98,39 +98,6 @@ TEST_F(PluginListTest, EmptyGroup) {
EXPECT_GE(1U, groups[i].web_plugins_info().size()); EXPECT_GE(1U, groups[i].web_plugins_info().size());
} }
TEST_F(PluginListTest, DisableOutdated) {
VersionRangeDefinition version_range[] = {
{ "0", "4", "3.0.44" },
{ "4", "5", "" }
};
WebPluginInfo plugin_3043(ASCIIToUTF16("MyPlugin"),
FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")),
ASCIIToUTF16("3.0.43"),
ASCIIToUTF16("MyPlugin version 3.0.43"));
WebPluginInfo plugin_3045(ASCIIToUTF16("MyPlugin"),
FilePath(FILE_PATH_LITERAL("/myplugin.3.0.45")),
ASCIIToUTF16("3.0.45"),
ASCIIToUTF16("MyPlugin version 3.0.45"));
plugin_list_.ClearPluginsToLoad();
plugin_list_.AddPluginToLoad(plugin_3043);
plugin_list_.AddPluginToLoad(plugin_3045);
// Enfore the load to run.
plugin_list_.RefreshPlugins();
std::vector<WebPluginInfo> plugins;
plugin_list_.GetPlugins(&plugins);
PluginGroup* group_3043 =
const_cast<PluginGroup*>(plugin_list_.GetPluginGroup(plugin_3043));
const PluginGroup* group_3045 = plugin_list_.GetPluginGroup(plugin_3045);
EXPECT_EQ(group_3043, group_3045);
group_3043->version_ranges_.push_back(VersionRange(version_range[0]));
group_3043->version_ranges_.push_back(VersionRange(version_range[1]));
EXPECT_EQ(plugin_3043.desc, group_3043->description());
EXPECT_TRUE(group_3043->IsVulnerable());
group_3043->DisableOutdatedPlugins();
EXPECT_EQ(plugin_3045.desc, group_3043->description());
EXPECT_FALSE(group_3043->IsVulnerable());
}
TEST_F(PluginListTest, BadPluginDescription) { TEST_F(PluginListTest, BadPluginDescription) {
WebPluginInfo plugin_3043(ASCIIToUTF16(""), WebPluginInfo plugin_3043(ASCIIToUTF16(""),
FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")), FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment