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

Unified Diff: chrome/browser/renderer_host/plugin_info_message_filter.cc

Issue 9874001: revert 128949 (and dependent 129252) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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/renderer_host/plugin_info_message_filter.cc
diff --git a/chrome/browser/renderer_host/plugin_info_message_filter.cc b/chrome/browser/renderer_host/plugin_info_message_filter.cc
index 11864a7c14c3ffdeefa8e1d181af5fb8635370ad..cc13c865db06720813190a710507781d5afe1afe 100644
--- a/chrome/browser/renderer_host/plugin_info_message_filter.cc
+++ b/chrome/browser/renderer_host/plugin_info_message_filter.cc
@@ -21,11 +21,6 @@
#include "webkit/plugins/npapi/plugin_group.h"
#include "webkit/plugins/npapi/plugin_list.h"
-#if defined(ENABLE_PLUGIN_INSTALLATION)
-#include "chrome/browser/plugin_finder.h"
-#include "chrome/browser/plugin_installer.h"
-#endif
-
#if defined(OS_WIN)
// These includes are only necessary for the PluginInfobarExperiment.
#include "chrome/common/attrition_experiments.h"
@@ -148,31 +143,7 @@ void PluginInfoMessageFilter::PluginsLoaded(
ChromeViewHostMsg_GetPluginInfo_Status status;
webkit::WebPluginInfo plugin;
std::string actual_mime_type;
- // This also fills in |actual_mime_type|.
- if (!context_.FindEnabledPlugin(params.render_view_id, params.url,
- params.top_origin_url, params.mime_type,
- &status, &plugin, &actual_mime_type)) {
- ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(
- reply_msg, status, plugin, actual_mime_type);
- Send(reply_msg);
- return;
- }
-#if defined(ENABLE_PLUGIN_INSTALLATION)
- PluginFinder::Get(base::Bind(&PluginInfoMessageFilter::GotPluginFinder, this,
- params, reply_msg, plugin, actual_mime_type));
-#else
- GotPluginFinder(params, reply_msg, plugin, actual_mime_type, NULL);
-#endif
-}
-
-void PluginInfoMessageFilter::GotPluginFinder(
- const GetPluginInfo_Params& params,
- IPC::Message* reply_msg,
- const webkit::WebPluginInfo& plugin,
- const std::string& actual_mime_type,
- PluginFinder* plugin_finder) {
- ChromeViewHostMsg_GetPluginInfo_Status status;
- context_.DecidePluginStatus(params, plugin, plugin_finder, &status);
+ context_.DecidePluginStatus(params, &status, &plugin, &actual_mime_type);
ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(
reply_msg, status, plugin, actual_mime_type);
Send(reply_msg);
@@ -180,16 +151,24 @@ void PluginInfoMessageFilter::GotPluginFinder(
void PluginInfoMessageFilter::Context::DecidePluginStatus(
const GetPluginInfo_Params& params,
- const webkit::WebPluginInfo& plugin,
- PluginFinder* plugin_finder,
- ChromeViewHostMsg_GetPluginInfo_Status* status) const {
- scoped_ptr<webkit::npapi::PluginGroup> group(
- webkit::npapi::PluginList::Singleton()->GetPluginGroup(plugin));
+ ChromeViewHostMsg_GetPluginInfo_Status* status,
+ webkit::WebPluginInfo* plugin,
+ std::string* actual_mime_type) const {
+ status->value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
+ // This also fills in |actual_mime_type|.
+ if (FindEnabledPlugin(params.render_view_id, params.url,
+ params.top_origin_url, params.mime_type,
+ status, plugin, actual_mime_type)) {
+ return;
+ }
ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
bool uses_default_content_setting = true;
// Check plug-in content settings. The primary URL is the top origin URL and
// the secondary URL is the plug-in URL.
+ scoped_ptr<webkit::npapi::PluginGroup> group(
+ webkit::npapi::PluginList::Singleton()->GetPluginGroup(*plugin));
+
GetPluginContentSetting(plugin, params.top_origin_url, params.url,
group->identifier(), &plugin_setting,
&uses_default_content_setting);
@@ -201,7 +180,7 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
PluginInfobarExperiment(&allow_outdated, &always_authorize);
// Check if the plug-in is outdated.
- if (group->IsVulnerable(plugin) && !allow_outdated) {
+ if (group->IsVulnerable(*plugin) && !allow_outdated) {
if (allow_outdated_plugins_.IsManaged()) {
status->value =
ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed;
@@ -212,13 +191,9 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
return;
}
-#if defined(ENABLE_PLUGIN_INSTALLATION)
// Check if the plug-in requires authorization.
- // TODO(bauerb): This should be a plain struct with the plug-in information.
- PluginInstaller* installer =
- plugin_finder->FindPluginWithIdentifier(group->identifier());
- if (((installer && installer->requires_authorization()) ||
- PluginService::GetInstance()->IsPluginUnstable(plugin.path)) &&
+ if ((group->RequiresAuthorization(*plugin) ||
+ PluginService::GetInstance()->IsPluginUnstable(plugin->path)) &&
!always_authorize &&
plugin_setting != CONTENT_SETTING_BLOCK &&
uses_default_content_setting) {
@@ -226,7 +201,6 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized;
return;
}
-#endif
if (plugin_setting == CONTENT_SETTING_ASK)
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay;
@@ -262,7 +236,7 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
*actual_mime_type = mime_types[i];
if (enabled) {
// We have found an enabled plug-in. Return immediately.
- return true;
+ return false;
}
// We have found a plug-in, but it's disabled. Keep looking for an
// enabled one.
@@ -276,18 +250,18 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kDisabled;
else
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound;
- return false;
+ return true;
}
void PluginInfoMessageFilter::Context::GetPluginContentSetting(
- const webkit::WebPluginInfo& plugin,
+ const webkit::WebPluginInfo* plugin,
const GURL& policy_url,
const GURL& plugin_url,
const std::string& resource,
ContentSetting* setting,
bool* uses_default_content_setting) const {
// Treat Native Client invocations like Javascript.
- bool is_nacl_plugin = (plugin.name == ASCIIToUTF16(
+ bool is_nacl_plugin = (plugin->name == ASCIIToUTF16(
chrome::ChromeContentClient::kNaClPluginName));
scoped_ptr<base::Value> value;

Powered by Google App Engine
This is Rietveld 408576698