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

Side by Side Diff: chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm

Issue 2842893002: Page Info permissions: make font sizes and spacing more consistent. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/page_info/permission_selector_row.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 // Minimum distance between the label and its corresponding menu. 87 // Minimum distance between the label and its corresponding menu.
88 const CGFloat kMinSeparationBetweenLabelAndMenu = 16; 88 const CGFloat kMinSeparationBetweenLabelAndMenu = 16;
89 89
90 // Square size of the permission delete button image. 90 // Square size of the permission delete button image.
91 const CGFloat kPermissionDeleteImageSize = 16; 91 const CGFloat kPermissionDeleteImageSize = 16;
92 92
93 // The spacing between individual permissions. 93 // The spacing between individual permissions.
94 const CGFloat kPermissionsVerticalSpacing = 16; 94 const CGFloat kPermissionsVerticalSpacing = 16;
95 95
96 // The spacing between permissions and their decision description labels. 96 // Spacing to add after a permission label, either directly on top of
97 const CGFloat kPermissionsDecisionVerticalSpacing = 4; 97 // kPermissionsVerticalSpacing, or before additional text (e.g. "X in use" for
98 // cookies).
99 const CGFloat kPermissionLabelBottomPadding = 4;
98 100
99 // Amount to lower each permission icon to align the icon baseline with the 101 // Amount to lower each permission icon to align the icon baseline with the
100 // label text. 102 // label text.
101 const CGFloat kPermissionIconYAdjustment = 1; 103 const CGFloat kPermissionIconYAdjustment = 1;
102 104
103 // Amount to lower each permission popup button to make its text align with the 105 // Amount to lower each permission popup button to make its text align with the
104 // permission label. 106 // permission label.
105 const CGFloat kPermissionPopupButtonYAdjustment = 3; 107 const CGFloat kPermissionPopupButtonYAdjustment = 3;
106 108
107 // Internal Page Bubble -------------------------------------------------------- 109 // Internal Page Bubble --------------------------------------------------------
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 [self alignPermissionIcon:imageView withTextField:label]; 899 [self alignPermissionIcon:imageView withTextField:label];
898 900
899 // Permissions specified by policy or an extension cannot be changed. 901 // Permissions specified by policy or an extension cannot be changed.
900 if (permissionInfo.source == content_settings::SETTING_SOURCE_EXTENSION || 902 if (permissionInfo.source == content_settings::SETTING_SOURCE_EXTENSION ||
901 permissionInfo.source == content_settings::SETTING_SOURCE_POLICY) { 903 permissionInfo.source == content_settings::SETTING_SOURCE_POLICY) {
902 [button setEnabled:NO]; 904 [button setEnabled:NO];
903 } 905 }
904 906
905 // Update |point| to match the y of the bottomost UI element added (|button|). 907 // Update |point| to match the y of the bottomost UI element added (|button|).
906 NSRect buttonFrame = [button frame]; 908 NSRect buttonFrame = [button frame];
907 point.y = NSMaxY(buttonFrame); 909 point.y = NSMaxY(labelFrame) + kPermissionLabelBottomPadding;
908 910
909 // Show the reason for the permission decision in a new row if it did not come 911 // Show the reason for the permission decision in a new row if it did not come
910 // from the user. 912 // from the user.
911 base::string16 reason = PageInfoUI::PermissionDecisionReasonToUIString( 913 base::string16 reason = PageInfoUI::PermissionDecisionReasonToUIString(
912 [self profile], permissionInfo, url_); 914 [self profile], permissionInfo, url_);
913 if (!reason.empty()) { 915 if (!reason.empty()) {
914 point.y += kPermissionsDecisionVerticalSpacing;
915 label = [self addText:reason 916 label = [self addText:reason
916 withSize:[NSFont systemFontSize] 917 withSize:[NSFont smallSystemFontSize]
917 bold:NO 918 bold:NO
918 toView:view 919 toView:view
919 atPoint:point]; 920 atPoint:point];
920 label.textColor = skia::SkColorToSRGBNSColor( 921 label.textColor = skia::SkColorToSRGBNSColor(
921 PageInfoUI::GetPermissionDecisionTextColor()); 922 PageInfoUI::GetPermissionDecisionTextColor());
922 point.y += NSHeight(label.frame); 923 point.y += NSHeight(label.frame);
923 } 924 }
924 925
925 return NSMakePoint(NSMaxX(buttonFrame), point.y); 926 return NSMakePoint(NSMaxX(buttonFrame), point.y);
926 } 927 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 atPoint:controlOrigin]; 1070 atPoint:controlOrigin];
1070 [cookiesLabel sizeToFit]; 1071 [cookiesLabel sizeToFit];
1071 1072
1072 NSPoint cookiesLabelOrigin = [cookiesLabel frame].origin; 1073 NSPoint cookiesLabelOrigin = [cookiesLabel frame].origin;
1073 cookiesLabelOrigin.x -= NSWidth([cookiesLabel frame]); 1074 cookiesLabelOrigin.x -= NSWidth([cookiesLabel frame]);
1074 [cookiesLabel setFrameOrigin:cookiesLabelOrigin]; 1075 [cookiesLabel setFrameOrigin:cookiesLabelOrigin];
1075 1076
1076 // Align the icon with the text. 1077 // Align the icon with the text.
1077 [self alignPermissionIcon:imageView withTextField:cookiesLabel]; 1078 [self alignPermissionIcon:imageView withTextField:cookiesLabel];
1078 1079
1079 controlOrigin.y += NSHeight([cookiesLabel frame]); 1080 controlOrigin.y +=
1081 NSHeight([cookiesLabel frame]) + kPermissionLabelBottomPadding;
1080 controlOrigin.x -= NSWidth([cookiesButton frame]) - kLinkButtonXAdjustment; 1082 controlOrigin.x -= NSWidth([cookiesButton frame]) - kLinkButtonXAdjustment;
1081 [cookiesButton setFrameOrigin:controlOrigin]; 1083 [cookiesButton setFrameOrigin:controlOrigin];
1082 } else { 1084 } else {
1083 controlOrigin.x += kPermissionImageSize + kPermissionImageSpacing; 1085 controlOrigin.x += kPermissionImageSize + kPermissionImageSpacing;
1084 NSTextField* cookiesLabel = 1086 NSTextField* cookiesLabel =
1085 [self addText:l10n_util::GetStringUTF16(IDS_PAGE_INFO_COOKIES) 1087 [self addText:l10n_util::GetStringUTF16(IDS_PAGE_INFO_COOKIES)
1086 withSize:[NSFont systemFontSize] 1088 withSize:[NSFont systemFontSize]
1087 bold:NO 1089 bold:NO
1088 toView:cookiesView_ 1090 toView:cookiesView_
1089 atPoint:controlOrigin]; 1091 atPoint:controlOrigin];
1090 [cookiesLabel sizeToFit]; 1092 [cookiesLabel sizeToFit];
1091 1093
1092 controlOrigin.y += NSHeight([cookiesLabel frame]); 1094 controlOrigin.y +=
1095 NSHeight([cookiesLabel frame]) + kPermissionLabelBottomPadding;
1093 controlOrigin.x -= kLinkButtonXAdjustment; 1096 controlOrigin.x -= kLinkButtonXAdjustment;
1094 [cookiesButton setFrameOrigin:controlOrigin]; 1097 [cookiesButton setFrameOrigin:controlOrigin];
1095 1098
1096 // Align the icon with the text. 1099 // Align the icon with the text.
1097 [self alignPermissionIcon:imageView withTextField:cookiesLabel]; 1100 [self alignPermissionIcon:imageView withTextField:cookiesLabel];
1098 } 1101 }
1099 1102
1100 controlOrigin.y += NSHeight([cookiesButton frame]); 1103 controlOrigin.y += NSHeight([cookiesButton frame]);
1101 [cookiesView_ 1104 [cookiesView_
1102 setFrameSize:NSMakeSize(NSWidth([cookiesView_ frame]), controlOrigin.y)]; 1105 setFrameSize:NSMakeSize(NSWidth([cookiesView_ frame]), controlOrigin.y)];
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 void PageInfoUIBridge::SetCookieInfo(const CookieInfoList& cookie_info_list) { 1219 void PageInfoUIBridge::SetCookieInfo(const CookieInfoList& cookie_info_list) {
1217 [bubble_controller_ setCookieInfo:cookie_info_list]; 1220 [bubble_controller_ setCookieInfo:cookie_info_list];
1218 } 1221 }
1219 1222
1220 void PageInfoUIBridge::SetPermissionInfo( 1223 void PageInfoUIBridge::SetPermissionInfo(
1221 const PermissionInfoList& permission_info_list, 1224 const PermissionInfoList& permission_info_list,
1222 ChosenObjectInfoList chosen_object_info_list) { 1225 ChosenObjectInfoList chosen_object_info_list) {
1223 [bubble_controller_ setPermissionInfo:permission_info_list 1226 [bubble_controller_ setPermissionInfo:permission_info_list
1224 andChosenObjects:std::move(chosen_object_info_list)]; 1227 andChosenObjects:std::move(chosen_object_info_list)];
1225 } 1228 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/page_info/permission_selector_row.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698