| 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/plugins/chrome_plugin_service_filter.h" | 5 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 15 #include "chrome/browser/engagement/site_engagement_service.h" | 15 #include "chrome/browser/engagement/site_engagement_service.h" |
| 16 #include "chrome/browser/permissions/permission_result.h" |
| 16 #include "chrome/browser/plugins/flash_temporary_permission_tracker.h" | 17 #include "chrome/browser/plugins/flash_temporary_permission_tracker.h" |
| 17 #include "chrome/browser/plugins/plugin_finder.h" | 18 #include "chrome/browser/plugins/plugin_finder.h" |
| 18 #include "chrome/browser/plugins/plugin_metadata.h" | 19 #include "chrome/browser/plugins/plugin_metadata.h" |
| 19 #include "chrome/browser/plugins/plugin_utils.h" | 20 #include "chrome/browser/plugins/plugin_utils.h" |
| 20 #include "chrome/browser/plugins/plugins_field_trial.h" | 21 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/common/chrome_features.h" | 23 #include "chrome/common/chrome_features.h" |
| 23 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
| 24 #include "components/content_settings/core/browser/host_content_settings_map.h" | 25 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 PluginUtils::ShouldPreferHtmlOverPlugins( | 217 PluginUtils::ShouldPreferHtmlOverPlugins( |
| 217 context_info->host_content_settings_map.get())) { | 218 context_info->host_content_settings_map.get())) { |
| 218 // Check the content setting first, and always respect the ALLOW or BLOCK | 219 // Check the content setting first, and always respect the ALLOW or BLOCK |
| 219 // state. When IsPluginAvailable() is called to check whether a plugin | 220 // state. When IsPluginAvailable() is called to check whether a plugin |
| 220 // should be advertised, |url| has the same origin as |main_frame_origin|. | 221 // should be advertised, |url| has the same origin as |main_frame_origin|. |
| 221 // The intended behavior is that Flash is advertised only if a Flash embed | 222 // The intended behavior is that Flash is advertised only if a Flash embed |
| 222 // hosted on the same origin as the main frame origin is allowed to run. | 223 // hosted on the same origin as the main frame origin is allowed to run. |
| 223 bool is_managed = false; | 224 bool is_managed = false; |
| 224 HostContentSettingsMap* settings_map = | 225 HostContentSettingsMap* settings_map = |
| 225 context_info_it->second->host_content_settings_map.get(); | 226 context_info_it->second->host_content_settings_map.get(); |
| 226 ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting( | 227 ContentSetting flash_setting = |
| 227 settings_map, main_frame_origin, plugin_content_url, &is_managed); | 228 PluginUtils::GetFlashPluginContentSetting( |
| 229 settings_map, main_frame_origin, plugin_content_url, &is_managed) |
| 230 .content_setting; |
| 228 flash_setting = PluginsFieldTrial::EffectiveContentSetting( | 231 flash_setting = PluginsFieldTrial::EffectiveContentSetting( |
| 229 settings_map, CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting); | 232 settings_map, CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting); |
| 230 double engagement = SiteEngagementService::GetScoreFromSettings( | 233 double engagement = SiteEngagementService::GetScoreFromSettings( |
| 231 settings_map, main_frame_origin.GetURL()); | 234 settings_map, main_frame_origin.GetURL()); |
| 232 | 235 |
| 233 if (flash_setting == CONTENT_SETTING_ALLOW) { | 236 if (flash_setting == CONTENT_SETTING_ALLOW) { |
| 234 UMA_HISTOGRAM_COUNTS_100(kEngagementSettingAllowedHistogram, engagement); | 237 UMA_HISTOGRAM_COUNTS_100(kEngagementSettingAllowedHistogram, engagement); |
| 235 return true; | 238 return true; |
| 236 } | 239 } |
| 237 | 240 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 326 |
| 324 const ChromePluginServiceFilter::ProcessDetails* | 327 const ChromePluginServiceFilter::ProcessDetails* |
| 325 ChromePluginServiceFilter::GetProcess( | 328 ChromePluginServiceFilter::GetProcess( |
| 326 int render_process_id) const { | 329 int render_process_id) const { |
| 327 std::map<int, ProcessDetails>::const_iterator it = | 330 std::map<int, ProcessDetails>::const_iterator it = |
| 328 plugin_details_.find(render_process_id); | 331 plugin_details_.find(render_process_id); |
| 329 if (it == plugin_details_.end()) | 332 if (it == plugin_details_.end()) |
| 330 return NULL; | 333 return NULL; |
| 331 return &it->second; | 334 return &it->second; |
| 332 } | 335 } |
| OLD | NEW |