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

Side by Side Diff: chrome/browser/ui/website_settings/permission_menu_model.cc

Issue 2264583003: [HBD] Map ASK to DETECT_IMPORTANT_CONTENT when PreferHtmlOverPlugins is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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/website_settings/permission_menu_model.h" 5 #include "chrome/browser/ui/website_settings/permission_menu_model.h"
6 6
7 #include "chrome/browser/plugins/plugins_field_trial.h"
7 #include "chrome/grit/generated_resources.h" 8 #include "chrome/grit/generated_resources.h"
8 #include "components/content_settings/core/browser/plugins_field_trial.h"
9 #include "content/public/common/origin_util.h" 9 #include "content/public/common/origin_util.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
11 11
12 PermissionMenuModel::PermissionMenuModel( 12 PermissionMenuModel::PermissionMenuModel(
13 const GURL& url, 13 const GURL& url,
14 const WebsiteSettingsUI::PermissionInfo& info, 14 const WebsiteSettingsUI::PermissionInfo& info,
15 const ChangeCallback& callback) 15 const ChangeCallback& callback)
16 : ui::SimpleMenuModel(this), permission_(info), callback_(callback) { 16 : ui::SimpleMenuModel(this), permission_(info), callback_(callback) {
17 DCHECK(!callback_.is_null()); 17 DCHECK(!callback_.is_null());
18 base::string16 label; 18 base::string16 label;
19 19
20 ContentSetting effective_default_setting = permission_.default_setting; 20 ContentSetting effective_default_setting = permission_.default_setting;
21 21
22 #if defined(ENABLE_PLUGINS) 22 #if defined(ENABLE_PLUGINS)
23 effective_default_setting = 23 effective_default_setting = PluginsFieldTrial::EffectiveContentSetting(
24 content_settings::PluginsFieldTrial::EffectiveContentSetting( 24 permission_.type, permission_.default_setting);
25 permission_.type, permission_.default_setting);
26 #endif // defined(ENABLE_PLUGINS) 25 #endif // defined(ENABLE_PLUGINS)
27 26
28 switch (effective_default_setting) { 27 switch (effective_default_setting) {
29 case CONTENT_SETTING_ALLOW: 28 case CONTENT_SETTING_ALLOW:
30 label = l10n_util::GetStringUTF16( 29 label = l10n_util::GetStringUTF16(
31 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW); 30 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW);
32 break; 31 break;
33 case CONTENT_SETTING_BLOCK: 32 case CONTENT_SETTING_BLOCK:
34 label = l10n_util::GetStringUTF16( 33 label = l10n_util::GetStringUTF16(
35 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK); 34 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 AddCheckItem(CONTENT_SETTING_BLOCK, 100 AddCheckItem(CONTENT_SETTING_BLOCK,
102 l10n_util::GetStringUTF16(IDS_PERMISSION_DENY)); 101 l10n_util::GetStringUTF16(IDS_PERMISSION_DENY));
103 } 102 }
104 103
105 PermissionMenuModel::~PermissionMenuModel() {} 104 PermissionMenuModel::~PermissionMenuModel() {}
106 105
107 bool PermissionMenuModel::IsCommandIdChecked(int command_id) const { 106 bool PermissionMenuModel::IsCommandIdChecked(int command_id) const {
108 ContentSetting setting = permission_.setting; 107 ContentSetting setting = permission_.setting;
109 108
110 #if defined(ENABLE_PLUGINS) 109 #if defined(ENABLE_PLUGINS)
111 setting = content_settings::PluginsFieldTrial::EffectiveContentSetting( 110 setting = PluginsFieldTrial::EffectiveContentSetting(permission_.type,
112 permission_.type, permission_.setting); 111 permission_.setting);
113 #endif // defined(ENABLE_PLUGINS) 112 #endif // defined(ENABLE_PLUGINS)
114 113
115 return setting == command_id; 114 return setting == command_id;
116 } 115 }
117 116
118 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const { 117 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const {
119 return true; 118 return true;
120 } 119 }
121 120
122 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) { 121 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) {
123 permission_.setting = static_cast<ContentSetting>(command_id); 122 permission_.setting = static_cast<ContentSetting>(command_id);
124 callback_.Run(permission_); 123 callback_.Run(permission_);
125 } 124 }
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugins_field_trial.cc ('k') | chrome/browser/ui/website_settings/website_settings_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698