| 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 9017c6b2d45a12c3434fe6fe8758e2f79d20bfae..ba56952882a3902010e1719e3ce041626ccd4f35 100644
|
| --- a/chrome/browser/renderer_host/plugin_info_message_filter.cc
|
| +++ b/chrome/browser/renderer_host/plugin_info_message_filter.cc
|
| @@ -9,6 +9,8 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/content_settings/content_settings_utils.h"
|
| #include "chrome/browser/content_settings/host_content_settings_map.h"
|
| +#include "chrome/browser/plugin_finder.h"
|
| +#include "chrome/browser/plugin_installer.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/content_settings.h"
|
| #include "chrome/common/chrome_content_client.h"
|
| @@ -143,7 +145,27 @@ void PluginInfoMessageFilter::PluginsLoaded(
|
| ChromeViewHostMsg_GetPluginInfo_Status status;
|
| webkit::WebPluginInfo plugin;
|
| std::string actual_mime_type;
|
| - context_.DecidePluginStatus(params, &status, &plugin, &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;
|
| + }
|
| + PluginFinder::Get(base::Bind(&PluginInfoMessageFilter::GotPluginFinder, this,
|
| + params, reply_msg, plugin, actual_mime_type));
|
| +}
|
| +
|
| +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);
|
| ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(
|
| reply_msg, status, plugin, actual_mime_type);
|
| Send(reply_msg);
|
| @@ -151,24 +173,16 @@ void PluginInfoMessageFilter::PluginsLoaded(
|
|
|
| void PluginInfoMessageFilter::Context::DecidePluginStatus(
|
| const GetPluginInfo_Params& params,
|
| - 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;
|
| - }
|
| + const webkit::WebPluginInfo& plugin,
|
| + PluginFinder* plugin_finder,
|
| + ChromeViewHostMsg_GetPluginInfo_Status* status) const {
|
| + scoped_ptr<webkit::npapi::PluginGroup> group(
|
| + webkit::npapi::PluginList::Singleton()->GetPluginGroup(plugin));
|
|
|
| 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);
|
| @@ -180,7 +194,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;
|
| @@ -192,8 +206,11 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
|
| }
|
|
|
| // Check if the plug-in requires authorization.
|
| - if ((group->RequiresAuthorization(*plugin) ||
|
| - PluginService::GetInstance()->IsPluginUnstable(plugin->path)) &&
|
| + // 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)) &&
|
| !always_authorize &&
|
| plugin_setting != CONTENT_SETTING_BLOCK &&
|
| uses_default_content_setting) {
|
| @@ -236,7 +253,7 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
|
| *actual_mime_type = mime_types[i];
|
| if (enabled) {
|
| // We have found an enabled plug-in. Return immediately.
|
| - return false;
|
| + return true;
|
| }
|
| // We have found a plug-in, but it's disabled. Keep looking for an
|
| // enabled one.
|
| @@ -250,18 +267,18 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
|
| status->value = ChromeViewHostMsg_GetPluginInfo_Status::kDisabled;
|
| else
|
| status->value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound;
|
| - return true;
|
| + return false;
|
| }
|
|
|
| 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;
|
|
|