| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/renderer_host/plugin_info_message_filter.h" | 5 #include "chrome/browser/renderer_host/plugin_info_message_filter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/content_settings/content_settings_utils.h" | 10 #include "chrome/browser/content_settings/content_settings_utils.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (allow_outdated_plugins_.IsManaged()) { | 179 if (allow_outdated_plugins_.IsManaged()) { |
| 180 status->value = | 180 status->value = |
| 181 ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed; | 181 ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed; |
| 182 } else { | 182 } else { |
| 183 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked; | 183 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked; |
| 184 } | 184 } |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 | 187 |
| 188 // Check if the plug-in requires authorization. | 188 // Check if the plug-in requires authorization. |
| 189 if ((plugin_status == | 189 if (plugin_status == |
| 190 PluginInstaller::SECURITY_STATUS_REQUIRES_AUTHORIZATION || | 190 PluginInstaller::SECURITY_STATUS_REQUIRES_AUTHORIZATION && |
| 191 PluginService::GetInstance()->IsPluginUnstable(plugin.path)) && | |
| 192 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS && | 191 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS && |
| 193 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS && | 192 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS && |
| 194 !always_authorize_plugins_.GetValue() && | 193 !always_authorize_plugins_.GetValue() && |
| 195 plugin_setting != CONTENT_SETTING_BLOCK && | 194 plugin_setting != CONTENT_SETTING_BLOCK && |
| 196 uses_default_content_setting) { | 195 uses_default_content_setting) { |
| 197 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized; | 196 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized; |
| 198 return; | 197 return; |
| 199 } | 198 } |
| 199 |
| 200 // Check if the plug-in is crashing too much. |
| 201 if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) && |
| 202 !always_authorize_plugins_.GetValue() && |
| 203 plugin_setting != CONTENT_SETTING_BLOCK && |
| 204 uses_default_content_setting) { |
| 205 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized; |
| 206 return; |
| 207 } |
| 200 #endif | 208 #endif |
| 201 | 209 |
| 202 if (plugin_setting == CONTENT_SETTING_ASK) | 210 if (plugin_setting == CONTENT_SETTING_ASK) |
| 203 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay; | 211 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay; |
| 204 else if (plugin_setting == CONTENT_SETTING_BLOCK) | 212 else if (plugin_setting == CONTENT_SETTING_BLOCK) |
| 205 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kBlocked; | 213 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kBlocked; |
| 206 } | 214 } |
| 207 | 215 |
| 208 bool PluginInfoMessageFilter::Context::FindEnabledPlugin( | 216 bool PluginInfoMessageFilter::Context::FindEnabledPlugin( |
| 209 int render_view_id, | 217 int render_view_id, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), | 289 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), |
| 282 &info)); | 290 &info)); |
| 283 } | 291 } |
| 284 } | 292 } |
| 285 *setting = content_settings::ValueToContentSetting(value.get()); | 293 *setting = content_settings::ValueToContentSetting(value.get()); |
| 286 *uses_default_content_setting = | 294 *uses_default_content_setting = |
| 287 !uses_plugin_specific_setting && | 295 !uses_plugin_specific_setting && |
| 288 info.primary_pattern == ContentSettingsPattern::Wildcard() && | 296 info.primary_pattern == ContentSettingsPattern::Wildcard() && |
| 289 info.secondary_pattern == ContentSettingsPattern::Wildcard(); | 297 info.secondary_pattern == ContentSettingsPattern::Wildcard(); |
| 290 } | 298 } |
| OLD | NEW |