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

Unified Diff: chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm

Issue 2743423004: Permissions: Show the reason for permission decisions made on the user's behalf. (Closed)
Patch Set: Rebase againnn 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
Index: chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm
index 585b90f1c4b98c0acb67daf76497ceb237dc8aaf..6ebc3ee1ed570d4837c3391c25e9ac26279c801f 100644
--- a/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm
@@ -95,6 +95,9 @@ const CGFloat kPermissionDeleteImageSize = 16;
// The spacing between individual permissions.
const CGFloat kPermissionsVerticalSpacing = 16;
+// The spacing between permissions and their decision description labels.
+const CGFloat kPermissionsDecisionVerticalSpacing = 4;
+
// Amount to lower each permission icon to align the icon baseline with the
// label text.
const CGFloat kPermissionIconYAdjustment = 1;
@@ -911,8 +914,24 @@ bool IsInternalURL(const GURL& url) {
[button setEnabled:NO];
}
+ // Show the permission decision reason, if it was not the user.
dominickn 2017/03/26 23:46:24 "Show the reason for the permission decision in a
Patti Lor 2017/03/27 05:52:40 Done.
NSRect buttonFrame = [button frame];
- return NSMakePoint(NSMaxX(buttonFrame), NSMaxY(buttonFrame));
+ int maxY = NSMaxY(buttonFrame);
+ base::string16 reason = WebsiteSettingsUI::PermissionDecisionReasonToString(
+ [self profile], permissionInfo, url_);
+ if (!reason.empty()) {
+ point.y = position.y + kPermissionsDecisionVerticalSpacing +
+ label.frame.size.height;
+ label = [self addText:reason
+ withSize:[NSFont systemFontSize]
+ bold:NO
+ toView:view
+ atPoint:point];
+ label.textColor = skia::SkColorToSRGBNSColor(SK_ColorGRAY);
+ maxY += label.frame.size.height;
+ }
+
+ return NSMakePoint(NSMaxX(buttonFrame), maxY);
}
// Adds a new row to the UI listing the permissions. Returns the NSPoint of the

Powered by Google App Engine
This is Rietveld 408576698