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

Unified Diff: content/renderer/render_view.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/renderer/render_view.cc
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 7218dfed368a24c5e747208f5a433087e0cd5b6d..b7257f4fe09c9d6287b75ac6c0abfd859f45dc0c 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -583,23 +583,29 @@ void RenderView::PluginCrashed(const FilePath& plugin_path) {
WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame,
const WebPluginParams& params) {
- webkit::WebPluginInfo info;
- std::string mime_type;
- bool found = GetPluginInfo(params.url, frame->top()->document().url(),
- params.mimeType.utf8(), &info, &mime_type);
- if (!found)
- return NULL;
-
- bool pepper_plugin_was_registered = false;
- scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
- pepper_delegate_.CreatePepperPluginModule(info,
- &pepper_plugin_was_registered));
- if (pepper_plugin_was_registered) {
- if (pepper_module)
- return CreatePepperPlugin(frame, params, info.path, pepper_module.get());
- return NULL;
+ std::vector<webkit::WebPluginInfo> plugins;
+ std::vector<std::string> mime_types;
+ std::vector<bool> allowed;
+ GetMatchingPlugins(
+ params.url, frame->top()->document().url(),
+ params.mimeType.utf8(), &plugins, &mime_types, &allowed);
+ for (size_t i = 0; i < plugins.size(); ++i) {
+ if (allowed[i]) {
+ bool pepper_plugin_was_registered = false;
+ scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
+ pepper_delegate_.CreatePepperPluginModule(
+ plugins[i], &pepper_plugin_was_registered));
+ if (pepper_plugin_was_registered) {
+ if (pepper_module)
+ return CreatePepperPlugin(frame, params, plugins[i].path,
+ pepper_module.get());
+ return NULL;
+ }
+ return CreateNPAPIPlugin(frame, params, plugins[i].path, mime_types[i]);
+ }
}
- return CreateNPAPIPlugin(frame, params, info.path, mime_type);
+ NOTREACHED() << "No allowed plug-in found";
+ return NULL;
}
void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) {
@@ -622,16 +628,15 @@ void RenderView::UnregisterPluginDelegate(WebPluginDelegateProxy* delegate) {
plugin_delegates_.erase(delegate);
}
-bool RenderView::GetPluginInfo(const GURL& url,
- const GURL& page_url,
- const std::string& mime_type,
- webkit::WebPluginInfo* plugin_info,
- std::string* actual_mime_type) {
- bool found = false;
- Send(new ViewHostMsg_GetPluginInfo(
- routing_id_, url, page_url, mime_type, &found, plugin_info,
- actual_mime_type));
- return found;
+void RenderView::GetMatchingPlugins(
+ const GURL& url,
+ const GURL& page_url,
+ const std::string& mime_type,
+ std::vector<webkit::WebPluginInfo>* plugins,
+ std::vector<std::string>* mime_types,
+ std::vector<bool>* allowed) {
+ Send(new ViewHostMsg_GetMatchingPlugins(
+ routing_id_, url, page_url, mime_type, plugins, mime_types, allowed));
}
base::SharedMemoryHandle RenderView::HostAllocateSharedMemoryBuffer(

Powered by Google App Engine
This is Rietveld 408576698