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

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

Issue 2291323003: [HBD] Update Plugins type in Website Settings Permissions UI (Closed)
Patch Set: add comments 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/browser/plugins/plugins_field_trial.h"
8 #include "chrome/common/chrome_features.h"
8 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
9 #include "content/public/common/origin_util.h" 10 #include "content/public/common/origin_util.h"
10 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
11 12
12 PermissionMenuModel::PermissionMenuModel( 13 PermissionMenuModel::PermissionMenuModel(
13 const GURL& url, 14 const GURL& url,
14 const WebsiteSettingsUI::PermissionInfo& info, 15 const WebsiteSettingsUI::PermissionInfo& info,
15 const ChangeCallback& callback) 16 const ChangeCallback& callback)
16 : ui::SimpleMenuModel(this), permission_(info), callback_(callback) { 17 : ui::SimpleMenuModel(this), permission_(info), callback_(callback) {
17 DCHECK(!callback_.is_null()); 18 DCHECK(!callback_.is_null());
(...skipping 13 matching lines...) Expand all
31 break; 32 break;
32 case CONTENT_SETTING_BLOCK: 33 case CONTENT_SETTING_BLOCK:
33 label = l10n_util::GetStringUTF16( 34 label = l10n_util::GetStringUTF16(
34 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK); 35 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK);
35 break; 36 break;
36 case CONTENT_SETTING_ASK: 37 case CONTENT_SETTING_ASK:
37 label = 38 label =
38 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK); 39 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK);
39 break; 40 break;
40 case CONTENT_SETTING_DETECT_IMPORTANT_CONTENT: 41 case CONTENT_SETTING_DETECT_IMPORTANT_CONTENT:
42 // TODO(tommycli): We display the ASK string for DETECT because with
43 // HTML5 by Default, Chrome will ask before running Flash on most sites.
44 // Once the feature flag is gone, migrate the actual setting to ASK.
41 label = l10n_util::GetStringUTF16( 45 label = l10n_util::GetStringUTF16(
42 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT); 46 base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins)
47 ? IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK
48 : IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT) ;
43 break; 49 break;
44 case CONTENT_SETTING_NUM_SETTINGS: 50 case CONTENT_SETTING_NUM_SETTINGS:
45 NOTREACHED(); 51 NOTREACHED();
46 default: 52 default:
47 break; 53 break;
48 } 54 }
49 AddCheckItem(CONTENT_SETTING_DEFAULT, label); 55 AddCheckItem(CONTENT_SETTING_DEFAULT, label);
50 56
51 // CONTENT_SETTING_ALLOW and CONTENT_SETTING_BLOCK are not allowed for 57 // CONTENT_SETTING_ALLOW and CONTENT_SETTING_BLOCK are not allowed for
52 // fullscreen or mouse lock on file:// URLs, because there wouldn't be 58 // fullscreen or mouse lock on file:// URLs, because there wouldn't be
(...skipping 13 matching lines...) Expand all
66 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || 72 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC ||
67 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; 73 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
68 if (!allow_disabled_for_notifications && 74 if (!allow_disabled_for_notifications &&
69 (!is_media_permission || content::IsOriginSecure(url)) && 75 (!is_media_permission || content::IsOriginSecure(url)) &&
70 !is_exclusive_access_on_file) { 76 !is_exclusive_access_on_file) {
71 label = l10n_util::GetStringUTF16( 77 label = l10n_util::GetStringUTF16(
72 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW); 78 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW);
73 AddCheckItem(CONTENT_SETTING_ALLOW, label); 79 AddCheckItem(CONTENT_SETTING_ALLOW, label);
74 } 80 }
75 81
76 if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS) { 82 // TODO(tommycli): With the HTML5 by Default feature, Flash is treated the
83 // same as any other permission with ASK, i.e. there is no ASK exception.
84 // Once the feature flag is gone, remove this block of code entirely.
85 if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS &&
86 !base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins)) {
77 label = l10n_util::GetStringUTF16( 87 label = l10n_util::GetStringUTF16(
78 IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT); 88 IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT);
79 AddCheckItem(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, label); 89 AddCheckItem(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, label);
80 } 90 }
81 91
82 if (permission_.type != CONTENT_SETTINGS_TYPE_FULLSCREEN && 92 if (permission_.type != CONTENT_SETTINGS_TYPE_FULLSCREEN &&
83 !is_exclusive_access_on_file) { 93 !is_exclusive_access_on_file) {
84 label = l10n_util::GetStringUTF16( 94 label = l10n_util::GetStringUTF16(
85 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK); 95 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK);
86 AddCheckItem(CONTENT_SETTING_BLOCK, label); 96 AddCheckItem(CONTENT_SETTING_BLOCK, label);
(...skipping 28 matching lines...) Expand all
115 } 125 }
116 126
117 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const { 127 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const {
118 return true; 128 return true;
119 } 129 }
120 130
121 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) { 131 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) {
122 permission_.setting = static_cast<ContentSetting>(command_id); 132 permission_.setting = static_cast<ContentSetting>(command_id);
123 callback_.Run(permission_); 133 callback_.Run(permission_);
124 } 134 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('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