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

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, 10 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/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..e7c3b9095c655a15742d612a232a6f559194785a 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,27 @@ WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = {
IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE, "name"},
};
+// Show a permission unless the following conditions hold:
+// - Its current value is "Ask" (or the the value representing the default).
raymes 2017/03/05 23:47:11 nit: I don't think the parentheses here make this
elawrence 2017/03/06 19:28:02 Also a repeated word: "the the"
lgarron 2017/03/09 02:41:24 Updated.
+// - Its built-in default value is "Ask".
+bool ShouldShowPermission(WebsiteSettingsUI::PermissionInfo permission_info) {
+ if (base::FeatureList::IsEnabled(kPageInfoAlwaysShowAllPermissions)) {
raymes 2017/03/05 23:47:11 nit: other single-line if-statements in this file
lgarron 2017/03/09 02:41:24 Fine, but: https://bugs.chromium.org/p/chromium/is
raymes 2017/03/09 03:25:19 I agree, I don't feel strongly which way, it's jus
+ return true;
+ }
+
+ if (permission_info.default_setting != CONTENT_SETTING_ASK) {
raymes 2017/03/05 23:47:11 Should this be comparing to the user-specified def
lgarron 2017/03/09 02:41:24 Chrome-specified. I thought that was what was hap
raymes 2017/03/09 03:25:19 To be clear by Chrome-specified default I mean the
+ return true;
+ }
+
+ switch (permission_info.setting) {
+ case CONTENT_SETTING_DEFAULT:
+ case CONTENT_SETTING_ASK:
+ return false;
+ default:
+ return true;
+ }
raymes 2017/03/05 23:47:11 Do you think we really want to hide settings that
lgarron 2017/03/09 02:41:24 Because of line 220, we always show permissions wh
raymes 2017/03/09 03:25:19 Yeah I guess I'm thinking in theory if the value w
+}
+
} // namespace
WebsiteSettings::WebsiteSettings(
@@ -674,7 +700,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) {

Powered by Google App Engine
This is Rietveld 408576698