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

Unified Diff: content/browser/plugin_service_impl.cc

Issue 12086077: Only permit plug-in loads in the browser if the plug-in isn't blocked or the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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: content/browser/plugin_service_impl.cc
===================================================================
--- content/browser/plugin_service_impl.cc (revision 180039)
+++ content/browser/plugin_service_impl.cc (working copy)
@@ -259,9 +259,13 @@
}
PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess(
+ int render_process_id,
const FilePath& plugin_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path))
+ return NULL;
+
PluginProcessHost* plugin_host = FindNpapiPluginProcess(plugin_path);
if (plugin_host)
return plugin_host;
@@ -281,11 +285,15 @@
}
PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess(
+ int render_process_id,
const FilePath& plugin_path,
const FilePath& profile_data_directory,
PpapiPluginProcessHost::PluginClient* client) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path))
+ return NULL;
+
PpapiPluginProcessHost* plugin_host =
FindPpapiPluginProcess(plugin_path, profile_data_directory);
if (plugin_host)
@@ -303,9 +311,13 @@
}
PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiBrokerProcess(
+ int render_process_id,
const FilePath& plugin_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path))
+ return NULL;
+
PpapiPluginProcessHost* plugin_host = FindPpapiBrokerProcess(plugin_path);
if (plugin_host)
return plugin_host;
@@ -346,11 +358,12 @@
}
void PluginServiceImpl::OpenChannelToPpapiPlugin(
+ int render_process_id,
const FilePath& plugin_path,
const FilePath& profile_data_directory,
PpapiPluginProcessHost::PluginClient* client) {
PpapiPluginProcessHost* plugin_host = FindOrStartPpapiPluginProcess(
- plugin_path, profile_data_directory, client);
+ render_process_id, plugin_path, profile_data_directory, client);
if (plugin_host) {
plugin_host->OpenChannelToPlugin(client);
} else {
@@ -360,9 +373,11 @@
}
void PluginServiceImpl::OpenChannelToPpapiBroker(
+ int render_process_id,
const FilePath& path,
PpapiPluginProcessHost::BrokerClient* client) {
- PpapiPluginProcessHost* plugin_host = FindOrStartPpapiBrokerProcess(path);
+ PpapiPluginProcessHost* plugin_host = FindOrStartPpapiBrokerProcess(
+ render_process_id, path);
if (plugin_host) {
plugin_host->OpenChannelToPlugin(client);
} else {
@@ -411,10 +426,14 @@
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&PluginServiceImpl::FinishOpenChannelToPlugin,
- base::Unretained(this), plugin_path, client));
+ base::Unretained(this),
+ render_process_id,
+ plugin_path,
+ client));
}
void PluginServiceImpl::FinishOpenChannelToPlugin(
+ int render_process_id,
const FilePath& plugin_path,
PluginProcessHost::Client* client) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -424,7 +443,8 @@
return;
pending_plugin_clients_.erase(client);
- PluginProcessHost* plugin_host = FindOrStartNpapiPluginProcess(plugin_path);
+ PluginProcessHost* plugin_host = FindOrStartNpapiPluginProcess(
+ render_process_id, plugin_path);
if (plugin_host) {
client->OnFoundPluginProcessHost(plugin_host);
plugin_host->OpenChannelToPlugin(client);
@@ -463,7 +483,7 @@
*is_stale = stale;
for (size_t i = 0; i < plugins.size(); ++i) {
- if (!filter_ || filter_->ShouldUsePlugin(render_process_id,
+ if (!filter_ || filter_->IsPluginEnabled(render_process_id,
render_view_id,
context,
url,

Powered by Google App Engine
This is Rietveld 408576698