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

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: Rebase with 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..a3bf3771017e0388fc4125a7c9ddfdf958b660ee 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,25 @@ bool IsInternalURL(const GURL& url) {
[button setEnabled:NO];
}
+ // Show the reason for the permission decision in a new row if it did not come
+ // from the user.
NSRect buttonFrame = [button frame];
- return NSMakePoint(NSMaxX(buttonFrame), NSMaxY(buttonFrame));
+ int maxY = NSMaxY(buttonFrame);
lgarron 2017/03/29 05:49:26 I know the existing code uses maxY, but mainly to
Patti Lor 2017/03/30 03:27:29 Done, thanks for the suggestions. I added a commen
+ base::string16 reason = PageInfoUI::PermissionDecisionReasonToUIString(
+ [self profile], permissionInfo, url_);
+ if (!reason.empty()) {
+ point.y = position.y + kPermissionsDecisionVerticalSpacing +
+ label.frame.size.height;
+ label = [self addText:reason
+ withSize:[NSFont systemFontSize]
lgarron 2017/03/29 05:49:26 Looking at the mocks, it seems to be this should b
Patti Lor 2017/03/30 03:27:29 I think there was a misunderstanding here - by moc
lgarron 2017/04/05 00:37:46 Ah. So, this is partially my fault. Per the specs
Patti Lor 2017/04/05 01:02:43 Thanks for clarifying & following up on the font s
+ bold:NO
+ toView:view
+ atPoint:point];
+ label.textColor = skia::SkColorToSRGBNSColor(SK_ColorGRAY);
lgarron 2017/03/29 05:49:26 Could you share the color across platforms by e.g.
Patti Lor 2017/03/30 03:27:29 Done.
+ 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