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

Unified Diff: chrome/browser/plugin_service.cc

Issue 6259008: When we detect a PDF with an unsupported feature, ask the user if they want t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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: chrome/browser/plugin_service.cc
===================================================================
--- chrome/browser/plugin_service.cc (revision 71882)
+++ chrome/browser/plugin_service.cc (working copy)
@@ -20,6 +20,7 @@
#include "chrome/browser/plugin_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -211,6 +212,9 @@
#endif
registrar_.Add(this, NotificationType::PLUGIN_ENABLE_STATUS_CHANGED,
NotificationService::AllSources());
+ registrar_.Add(this,
+ NotificationType::RENDERER_PROCESS_CLOSED,
+ NotificationService::AllSources());
}
PluginService::~PluginService() {
@@ -283,6 +287,8 @@
}
void PluginService::OpenChannelToPlugin(
+ int render_process_id,
+ int render_view_id,
const GURL& url,
const std::string& mime_type,
PluginProcessHost::Client* client) {
@@ -292,16 +298,19 @@
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(
this, &PluginService::GetAllowedPluginForOpenChannelToPlugin,
- url, mime_type, client));
+ render_process_id, render_view_id, url, mime_type, client));
}
void PluginService::GetAllowedPluginForOpenChannelToPlugin(
+ int render_process_id,
+ int render_view_id,
const GURL& url,
const std::string& mime_type,
PluginProcessHost::Client* client) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
webkit::npapi::WebPluginInfo info;
- bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL);
+ bool found = GetFirstAllowedPluginInfo(
+ render_process_id, render_view_id, url, mime_type, &info, NULL);
FilePath plugin_path;
if (found && info.enabled)
plugin_path = FilePath(info.path);
@@ -327,6 +336,8 @@
}
bool PluginService::GetFirstAllowedPluginInfo(
+ int render_process_id,
+ int render_view_id,
const GURL& url,
const std::string& mime_type,
webkit::npapi::WebPluginInfo* info,
@@ -352,6 +363,18 @@
}
return false;
#else
+ {
+ AutoLock auto_lock(overridden_plugins_lock_);
+ for (size_t i = 0; i < overridden_plugins_.size(); ++i) {
+ if (overridden_plugins_[i].render_process_id == render_process_id &&
+ overridden_plugins_[i].render_view_id == render_view_id &&
+ overridden_plugins_[i].url == url) {
+ *actual_mime_type = mime_type;
+ *info = overridden_plugins_[i].plugin;
+ return true;
+ }
+ }
+ }
return webkit::npapi::PluginList::Singleton()->GetPluginInfo(
url, mime_type, allow_wildcard, info, actual_mime_type);
#endif
@@ -434,6 +457,18 @@
PurgePluginListCache(false);
break;
}
+ case NotificationType::RENDERER_PROCESS_CLOSED: {
+ int render_process_id = Source<RenderProcessHost>(source).ptr()->id();
+
+ AutoLock auto_lock(overridden_plugins_lock_);
+ for (size_t i = 0; i < overridden_plugins_.size(); ++i) {
+ if (overridden_plugins_[i].render_process_id == render_process_id) {
+ overridden_plugins_.erase(overridden_plugins_.begin() + i);
+ break;
+ }
+ }
+ break;
+ }
default:
NOTREACHED();
}
@@ -455,6 +490,11 @@
url.host() == required_url.host());
}
+void PluginService::OverridePluginForTab(OverriddenPlugin plugin) {
+ AutoLock auto_lock(overridden_plugins_lock_);
+ overridden_plugins_.push_back(plugin);
+}
+
void PluginService::RegisterPepperPlugins() {
std::vector<PepperPluginInfo> plugins;
PepperPluginRegistry::GetList(&plugins);

Powered by Google App Engine
This is Rietveld 408576698