| 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/ui/content_settings/content_setting_image_model.h" | 5 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
| 6 | 6 |
| 7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 11 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 13 #include "chrome/browser/plugins/plugin_utils.h" |
| 13 #include "chrome/browser/prerender/prerender_manager.h" | 14 #include "chrome/browser/prerender/prerender_manager.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/chrome_features.h" | 16 #include "chrome/common/chrome_features.h" |
| 16 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 17 #include "chrome/grit/theme_resources.h" | 18 #include "chrome/grit/theme_resources.h" |
| 18 #include "components/content_settings/core/browser/host_content_settings_map.h" | 19 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/material_design/material_design_controller.h" | 22 #include "ui/base/material_design/material_design_controller.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 HostContentSettingsMap* map = | 221 HostContentSettingsMap* map = |
| 221 HostContentSettingsMapFactory::GetForProfile(profile); | 222 HostContentSettingsMapFactory::GetForProfile(profile); |
| 222 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { | 223 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 223 GURL url = web_contents->GetURL(); | 224 GURL url = web_contents->GetURL(); |
| 224 ContentSetting setting = | 225 ContentSetting setting = |
| 225 map->GetContentSetting(url, url, type, std::string()); | 226 map->GetContentSetting(url, url, type, std::string()); |
| 226 | 227 |
| 227 // For plugins, show the animated explanation in these cases: | 228 // For plugins, show the animated explanation in these cases: |
| 228 // - The plugin is blocked despite the user having content setting ALLOW. | 229 // - The plugin is blocked despite the user having content setting ALLOW. |
| 229 // - The user has disabled Flash using BLOCK and HTML5 By Default feature. | 230 // - The user has disabled Flash using BLOCK and HTML5 By Default feature. |
| 230 bool show_explanation = | 231 bool show_explanation = setting == CONTENT_SETTING_ALLOW || |
| 231 setting == CONTENT_SETTING_ALLOW || | 232 (setting == CONTENT_SETTING_BLOCK && |
| 232 (setting == CONTENT_SETTING_BLOCK && | 233 PluginUtils::ShouldPreferHtmlOverPlugins(map)); |
| 233 base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins)); | |
| 234 if (!show_explanation) | 234 if (!show_explanation) |
| 235 explanation_id = 0; | 235 explanation_id = 0; |
| 236 } | 236 } |
| 237 | 237 |
| 238 // If a content type is blocked by default and was accessed, display the | 238 // If a content type is blocked by default and was accessed, display the |
| 239 // content blocked page action. | 239 // content blocked page action. |
| 240 TabSpecificContentSettings* content_settings = | 240 TabSpecificContentSettings* content_settings = |
| 241 TabSpecificContentSettings::FromWebContents(web_contents); | 241 TabSpecificContentSettings::FromWebContents(web_contents); |
| 242 if (!content_settings) | 242 if (!content_settings) |
| 243 return; | 243 return; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 554 |
| 555 #if defined(OS_MACOSX) | 555 #if defined(OS_MACOSX) |
| 556 bool ContentSettingImageModel::UpdateFromWebContentsAndCheckIfIconChanged( | 556 bool ContentSettingImageModel::UpdateFromWebContentsAndCheckIfIconChanged( |
| 557 content::WebContents* web_contents) { | 557 content::WebContents* web_contents) { |
| 558 gfx::VectorIconId old_icon = icon_id_; | 558 gfx::VectorIconId old_icon = icon_id_; |
| 559 gfx::VectorIconId old_badge_icon = icon_badge_id_; | 559 gfx::VectorIconId old_badge_icon = icon_badge_id_; |
| 560 UpdateFromWebContents(web_contents); | 560 UpdateFromWebContents(web_contents); |
| 561 return old_icon != icon_id_ && old_badge_icon != icon_badge_id_; | 561 return old_icon != icon_id_ && old_badge_icon != icon_badge_id_; |
| 562 } | 562 } |
| 563 #endif | 563 #endif |
| OLD | NEW |