Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2105)

Unified Diff: chrome/browser/plugins/plugin_metadata.cc

Issue 11016005: Using MIME types in addition to plugin name to differentiate between plugins. (Closed) Base URL: http://git.chromium.org/chromium/src.git@5_plugins_resource_service
Patch Set: fixed error Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/plugins/plugin_metadata.h ('k') | chrome/browser/plugins/plugin_metadata_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/plugins/plugin_metadata.h ('k') | chrome/browser/plugins/plugin_metadata_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698