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

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

Issue 2702923002: Page Info: Hide default permissions with a value of Ask if the default is Ask. (Closed)
Patch Set: Page Info: Hide default permissions with a value of Ask if the default is Ask. Created 3 years, 9 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
« no previous file with comments | « chrome/browser/ui/views/website_settings/website_settings_popup_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/website_settings/website_settings.cc
diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc
index a8549dddb7e8f68511f29b23c857127dbecb6272..0e51b6a6040048b4cec3917dd80c7b63a43bd3f9 100644
--- a/chrome/browser/ui/website_settings/website_settings.cc
+++ b/chrome/browser/ui/website_settings/website_settings.cc
@@ -11,6 +11,7 @@
#include <vector>
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/i18n/time_formatting.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -83,6 +84,10 @@ using content::BrowserThread;
namespace {
+// TODO(crbug.com/698469): Remove kPageInfoAlwaysShowAllPermissions
+const base::Feature kPageInfoAlwaysShowAllPermissions{
+ "PageInfoAlwaysShowAllPermissions", base::FEATURE_DISABLED_BY_DEFAULT};
+
// Events for UMA. Do not reorder or change!
enum SSLCertificateDecisionsDidRevoke {
USER_CERT_DECISIONS_NOT_REVOKED = 0,
@@ -204,6 +209,25 @@ WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = {
IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE, "name"},
};
+// Show a permission unless the following conditions hold:
+// - Its current value is ASK or DEFAULT.
+// - Its built-in default value is ASK.
+bool ShouldShowPermission(WebsiteSettingsUI::PermissionInfo permission_info) {
+ if (base::FeatureList::IsEnabled(kPageInfoAlwaysShowAllPermissions))
+ return true;
+
+ if (permission_info.default_setting != CONTENT_SETTING_ASK)
+ return true;
+
+ switch (permission_info.setting) {
+ case CONTENT_SETTING_DEFAULT:
+ case CONTENT_SETTING_ASK:
+ return false;
+ default:
+ return true;
+ }
+}
+
} // namespace
WebsiteSettings::WebsiteSettings(
@@ -674,7 +698,9 @@ void WebsiteSettings::PresentSitePermissions() {
NULL);
}
- permission_info_list.push_back(permission_info);
+ if (ShouldShowPermission(permission_info)) {
+ permission_info_list.push_back(permission_info);
+ }
}
for (const ChooserUIInfo& ui_info : kChooserUIInfo) {
« no previous file with comments | « chrome/browser/ui/views/website_settings/website_settings_popup_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698