diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 15:22:07 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 15:22:07 +0000 |
commit | a644ad7d5b204b34af69fd109e72f80805118281 (patch) | |
tree | cd9eeb4b23d62607f83a7c1264d8dc37a2ebebf9 /chrome/common | |
parent | 06bdc0b535b8e2b0f9f8b5ae327ed808d44f95b2 (diff) | |
download | chromium_src-a644ad7d5b204b34af69fd109e72f80805118281.zip chromium_src-a644ad7d5b204b34af69fd109e72f80805118281.tar.gz chromium_src-a644ad7d5b204b34af69fd109e72f80805118281.tar.bz2 |
When a plug-in group has no name, fall back to filename without extension.
BUG=48571
TEST=manual
Review URL: http://codereview.chromium.org/3424012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/plugin_group.cc | 20 | ||||
-rw-r--r-- | chrome/common/plugin_group.h | 5 |
2 files changed, 20 insertions, 5 deletions
diff --git a/chrome/common/plugin_group.cc b/chrome/common/plugin_group.cc index bafa65c3..6297466 100644 --- a/chrome/common/plugin_group.cc +++ b/chrome/common/plugin_group.cc @@ -280,22 +280,36 @@ void PluginGroup::AddPlugin(const WebPluginInfo& plugin, int position) { UpdateActivePlugin(plugin); } +string16 PluginGroup::GetGroupName() const { + if (!group_name_.empty()) + return group_name_; + DCHECK_EQ(1u, web_plugin_infos_.size()); + FilePath::StringType path = + web_plugin_infos_[0].path.BaseName().RemoveExtension().value(); +#if defined(OS_POSIX) + return UTF8ToUTF16(path); +#elif defined(OS_WIN) + return WideToUTF16(path); +#endif +} + DictionaryValue* PluginGroup::GetSummary() const { DictionaryValue* result = new DictionaryValue(); - result->SetString("name", group_name_); + result->SetString("name", GetGroupName()); result->SetBoolean("enabled", enabled_); return result; } DictionaryValue* PluginGroup::GetDataForUI() const { + string16 name = GetGroupName(); DictionaryValue* result = new DictionaryValue(); - result->SetString("name", group_name_); + result->SetString("name", name); result->SetString("description", description_); result->SetString("version", version_->GetString()); result->SetString("update_url", update_url_); result->SetBoolean("critical", IsVulnerable()); - bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(group_name_); + bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(name); ListValue* plugin_files = new ListValue(); bool all_plugins_disabled_by_policy = true; for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { diff --git a/chrome/common/plugin_group.h b/chrome/common/plugin_group.h index 00c947b..62f5b6f 100644 --- a/chrome/common/plugin_group.h +++ b/chrome/common/plugin_group.h @@ -94,8 +94,9 @@ class PluginGroup { // Returns whether the plugin group is enabled or not. bool Enabled() const { return enabled_; } - // Returns this group's name - const string16& GetGroupName() const { return group_name_; } + // Returns this group's name, or the filename without extension if the name + // is empty. + string16 GetGroupName() const; // Returns the description of the highest-priority plug-in in the group. const string16& description() const { return description_; } |