| Index: chrome/browser/plugins/plugin_metadata.cc
|
| diff --git a/chrome/browser/plugins/plugin_metadata.cc b/chrome/browser/plugins/plugin_metadata.cc
|
| index 5013c7f173401114be3753373d115038778ea23b..7bef6c9fc35a61645978a3fda193c4e635ede792 100644
|
| --- a/chrome/browser/plugins/plugin_metadata.cc
|
| +++ b/chrome/browser/plugins/plugin_metadata.cc
|
| @@ -4,7 +4,10 @@
|
|
|
| #include "chrome/browser/plugins/plugin_metadata.h"
|
|
|
| +#include <algorithm>
|
| +
|
| #include "base/logging.h"
|
| +#include "webkit/plugins/npapi/plugin_list.h"
|
| #include "webkit/plugins/npapi/plugin_utils.h"
|
| #include "webkit/plugins/webplugininfo.h"
|
|
|
| @@ -23,13 +26,15 @@ PluginMetadata::PluginMetadata(const std::string& identifier,
|
| bool url_for_display,
|
| const GURL& plugin_url,
|
| const GURL& help_url,
|
| - const string16& group_name_matcher)
|
| + const string16& group_name_matcher,
|
| + const std::string& language)
|
| : identifier_(identifier),
|
| name_(name),
|
| group_name_matcher_(group_name_matcher),
|
| url_for_display_(url_for_display),
|
| plugin_url_(plugin_url),
|
| - help_url_(help_url) {
|
| + help_url_(help_url),
|
| + language_(language) {
|
| }
|
|
|
| PluginMetadata::~PluginMetadata() {
|
| @@ -41,7 +46,29 @@ void PluginMetadata::AddVersion(const Version& version,
|
| versions_[version] = status;
|
| }
|
|
|
| +void PluginMetadata::AddMimeType(const std::string& mime_type) {
|
| + all_mime_types_.push_back(mime_type);
|
| +}
|
| +
|
| +void PluginMetadata::AddMatchingMimeType(const std::string& mime_type) {
|
| + matching_mime_types_.push_back(mime_type);
|
| +}
|
| +
|
| +bool PluginMetadata::HasMimeType(const std::string& mime_type) const {
|
| + return std::find(all_mime_types_.begin(), all_mime_types_.end(), mime_type) !=
|
| + all_mime_types_.end();
|
| +}
|
| +
|
| bool PluginMetadata::MatchesPlugin(const webkit::WebPluginInfo& plugin) {
|
| + using webkit::npapi::PluginList;
|
| +
|
| + for (size_t i = 0; i < matching_mime_types_.size(); ++i) {
|
| + // To have a match, every one of the |matching_mime_types_|
|
| + // must be handled by the plug-in.
|
| + if (!PluginList::SupportsType(plugin, matching_mime_types_[i], false))
|
| + return false;
|
| + }
|
| +
|
| return plugin.name.find(group_name_matcher_) != string16::npos;
|
| }
|
|
|
| @@ -100,7 +127,8 @@ scoped_ptr<PluginMetadata> PluginMetadata::Clone() const {
|
| url_for_display_,
|
| plugin_url_,
|
| help_url_,
|
| - group_name_matcher_);
|
| + group_name_matcher_,
|
| + language_);
|
| copy->versions_ = versions_;
|
| return make_scoped_ptr(copy);
|
| }
|
|
|