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

Unified Diff: content/browser/plugin_service.cc

Issue 7990005: Use a placeholder instead of the default plugin for missing plug-ins on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 3 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
Index: content/browser/plugin_service.cc
diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc
index 6be232ac811c08244bb695bf3af5ea5561cdabb9..359f5b79deb3d4e61969350c72b3309919960d3b 100644
--- a/content/browser/plugin_service.cc
+++ b/content/browser/plugin_service.cc
@@ -410,37 +410,62 @@ bool PluginService::GetPluginInfo(int render_process_id,
bool* use_stale,
webkit::WebPluginInfo* info,
std::string* actual_mime_type) {
+ std::vector<webkit::WebPluginInfo> plugins;
+ std::vector<std::string> mime_types;
+ std::vector<bool> allowed;
+ GetMatchingPlugins(
+ render_process_id, render_view_id, context, url, page_url, mime_type,
+ allow_wildcard, use_stale, &plugins, &mime_types, &allowed);
+ for (size_t i = 0; i < plugins.size(); ++i) {
+ if (allowed[i]) {
+ *info = plugins[i];
+ if (actual_mime_type)
+ *actual_mime_type = mime_types[i];
+ return true;
+ }
+ }
+ return false;
+}
+
+void PluginService::GetMatchingPlugins(
+ int render_process_id,
+ int render_view_id,
+ const content::ResourceContext& context,
+ const GURL& url,
+ const GURL& page_url,
+ const std::string& mime_type,
+ bool allow_wildcard,
+ bool* use_stale,
+ std::vector<webkit::WebPluginInfo>* plugins,
+ std::vector<std::string>* mime_types,
+ std::vector<bool>* allowed) {
webkit::npapi::PluginList* plugin_list =
webkit::npapi::PluginList::Singleton();
// GetPluginInfoArray may need to load the plugins, so we need to be
// on the FILE thread.
DCHECK(use_stale || BrowserThread::CurrentlyOn(BrowserThread::FILE));
- std::vector<webkit::WebPluginInfo> plugins;
- std::vector<std::string> mime_types;
plugin_list->GetPluginInfoArray(
- url, mime_type, allow_wildcard, use_stale, &plugins, &mime_types);
- if (plugins.size() > 1 &&
- plugins.back().path ==
+ url, mime_type, allow_wildcard, use_stale, plugins, mime_types);
+ if (plugins->size() > 1 &&
+ plugins->back().path ==
FilePath(webkit::npapi::kDefaultPluginLibraryName)) {
// If there is at least one plug-in handling the required MIME type (apart
// from the default plug-in), we don't need the default plug-in.
- plugins.pop_back();
+ plugins->pop_back();
}
- for (size_t i = 0; i < plugins.size(); ++i) {
- if (!filter_ || filter_->ShouldUsePlugin(render_process_id,
- render_view_id,
- &context,
- url,
- page_url,
- &plugins[i])) {
- *info = plugins[i];
- if (actual_mime_type)
- *actual_mime_type = mime_types[i];
- return true;
+ for (size_t i = 0; i < plugins->size(); ++i) {
+ bool plugin_allowed = true;
+ if (filter_) {
+ plugin_allowed = filter_->ShouldUsePlugin(render_process_id,
+ render_view_id,
+ &context,
+ url,
+ page_url,
+ &(*plugins)[i]);
}
+ allowed->push_back(plugin_allowed);
}
- return false;
}
void PluginService::RefreshPluginList() {

Powered by Google App Engine
This is Rietveld 408576698