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

Unified Diff: chrome/browser/ui/website_settings/permission_menu_model.cc

Issue 2408613002: Replace kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… (Closed)
Patch Set: Replace remaining kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… Created 4 years, 2 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/ui/website_settings/permission_menu_model.cc
diff --git a/chrome/browser/ui/website_settings/permission_menu_model.cc b/chrome/browser/ui/website_settings/permission_menu_model.cc
index efaa99c2dff8af59ff9e3104be7a0af5e37c23eb..b5564d73c6f859e1e18e795bbd55108f04620e89 100644
--- a/chrome/browser/ui/website_settings/permission_menu_model.cc
+++ b/chrome/browser/ui/website_settings/permission_menu_model.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/website_settings/permission_menu_model.h"
+#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
+#include "chrome/browser/plugins/plugin_utils.h"
#include "chrome/browser/plugins/plugins_field_trial.h"
#include "chrome/common/chrome_features.h"
#include "chrome/grit/generated_resources.h"
@@ -11,10 +13,15 @@
#include "ui/base/l10n/l10n_util.h"
PermissionMenuModel::PermissionMenuModel(
+ Profile* profile,
const GURL& url,
const WebsiteSettingsUI::PermissionInfo& info,
const ChangeCallback& callback)
- : ui::SimpleMenuModel(this), permission_(info), callback_(callback) {
+ : ui::SimpleMenuModel(this),
+ host_content_settings_map_(
+ HostContentSettingsMapFactory::GetForProfile(profile)),
+ permission_(info),
+ callback_(callback) {
DCHECK(!callback_.is_null());
base::string16 label;
@@ -22,7 +29,8 @@ PermissionMenuModel::PermissionMenuModel(
#if defined(ENABLE_PLUGINS)
effective_default_setting = PluginsFieldTrial::EffectiveContentSetting(
- permission_.type, permission_.default_setting);
+ host_content_settings_map_, permission_.type,
+ permission_.default_setting);
#endif // defined(ENABLE_PLUGINS)
switch (effective_default_setting) {
@@ -43,7 +51,7 @@ PermissionMenuModel::PermissionMenuModel(
// HTML5 by Default, Chrome will ask before running Flash on most sites.
// Once the feature flag is gone, migrate the actual setting to ASK.
label = l10n_util::GetStringUTF16(
- base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins)
+ PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map_)
? IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK
: IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT);
break;
@@ -83,7 +91,7 @@ PermissionMenuModel::PermissionMenuModel(
// same as any other permission with ASK, i.e. there is no ASK exception.
// Once the feature flag is gone, remove this block of code entirely.
if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS &&
- !base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins)) {
+ !PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map_)) {
label = l10n_util::GetStringUTF16(
IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT);
AddCheckItem(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, label);
@@ -97,10 +105,14 @@ PermissionMenuModel::PermissionMenuModel(
}
}
-PermissionMenuModel::PermissionMenuModel(const GURL& url,
+PermissionMenuModel::PermissionMenuModel(Profile* profile,
+ const GURL& url,
ContentSetting setting,
const ChangeCallback& callback)
- : ui::SimpleMenuModel(this), callback_(callback) {
+ : ui::SimpleMenuModel(this),
+ host_content_settings_map_(
+ HostContentSettingsMapFactory::GetForProfile(profile)),
+ callback_(callback) {
DCHECK(setting == CONTENT_SETTING_ALLOW || setting == CONTENT_SETTING_BLOCK);
permission_.type = CONTENT_SETTINGS_TYPE_DEFAULT;
permission_.setting = setting;
@@ -117,8 +129,8 @@ bool PermissionMenuModel::IsCommandIdChecked(int command_id) const {
ContentSetting setting = permission_.setting;
#if defined(ENABLE_PLUGINS)
- setting = PluginsFieldTrial::EffectiveContentSetting(permission_.type,
- permission_.setting);
+ setting = PluginsFieldTrial::EffectiveContentSetting(
+ host_content_settings_map_, permission_.type, permission_.setting);
#endif // defined(ENABLE_PLUGINS)
return setting == command_id;

Powered by Google App Engine
This is Rietveld 408576698