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

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

Issue 2743423004: Permissions: Show the reason for permission decisions made on the user's behalf. (Closed)
Patch Set: Review comments. 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/page_info_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm
index a86a1934953eee48a40d820913670921ea481193..1d0187ac2b6b4a6a49ac081a6e72de0f94d953e3 100644
--- a/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm
@@ -94,6 +94,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;
@@ -900,8 +903,27 @@ bool IsInternalURL(const GURL& url) {
[button setEnabled:NO];
}
+ // Update |point| to match the y of the bottomost UI element added (|button|).
NSRect buttonFrame = [button frame];
- return NSMakePoint(NSMaxX(buttonFrame), NSMaxY(buttonFrame));
+ point.y = NSMaxY(buttonFrame);
+
+ // Show the reason for the permission decision in a new row if it did not come
+ // from the user.
+ base::string16 reason = PageInfoUI::PermissionDecisionReasonToUIString(
+ [self profile], permissionInfo, url_);
+ if (!reason.empty()) {
+ point.y += kPermissionsDecisionVerticalSpacing;
+ label = [self addText:reason
+ withSize:[NSFont systemFontSize]
+ bold:NO
+ toView:view
+ atPoint:point];
+ label.textColor = skia::SkColorToSRGBNSColor(
+ PageInfoUI::GetPermissionDecisionTextColor());
+ point.y += NSHeight(label.frame);
+ }
+
+ return NSMakePoint(NSMaxX(buttonFrame), point.y);
}
// Adds a new row to the UI listing the permissions. Returns the NSPoint of the
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/cocoa/page_info/page_info_bubble_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698