Index: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
index 65937f89a5a5e02a2628252e9bfae5efab5baa25..1f983cb034c61983ecde480aea2969c5889657d3 100644 |
--- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
+++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
@@ -210,7 +210,7 @@ class ContentSettingBubbleWebContentsObserverBridge |
- (void)initializeBlockedPluginsList; |
- (void)initializeTitle; |
- (void)initializeRadioGroup; |
-- (void)initializePopupList; |
+- (void)initializeItemList; |
- (void)initializeGeoLists; |
- (void)initializeMediaMenus; |
- (void)initializeMIDISysExLists; |
@@ -384,16 +384,19 @@ class ContentSettingBubbleWebContentsObserverBridge |
} |
- (void)initializeBlockedPluginsList { |
- NSString* label = base::SysUTF16ToNSString( |
- contentSettingBubbleModel_->bubble_content().plugin_names); |
- [blockedResourcesField_ setStringValue:label]; |
+ int delta = |
+ NSMinY([titleLabel_ frame]) - NSMinY([blockedResourcesField_ frame]); |
+ [blockedResourcesField_ removeFromSuperview]; |
+ NSRect frame = [[self window] frame]; |
+ frame.size.height -= delta; |
+ [[self window] setFrame:frame display:NO]; |
} |
meacer
2015/03/20 19:40:04
This is essentially a revert of https://codereview
msw
2015/03/20 22:06:33
I'm less familiar with Cocoa, can you get c/b/ui/c
|
-- (void)initializePopupList { |
+- (void)initializeItemList { |
// I didn't put the buttons into a NSMatrix because then they are only one |
// entity in the key view loop. This way, one can tab through all of them. |
- const ContentSettingBubbleModel::PopupItems& popupItems = |
- contentSettingBubbleModel_->bubble_content().popup_items; |
+ const ContentSettingBubbleModel::ListItems& listItems = |
+ contentSettingBubbleModel_->bubble_content().list_items; |
// Get the pre-resize frame of the radio group. Its origin is where the |
// popup list should go. |
@@ -403,35 +406,29 @@ class ContentSettingBubbleWebContentsObserverBridge |
// themselves when the window is enlarged. |
// Heading and radio box are already 1 * kLinkOuterPadding apart in the nib, |
// so only 1 * kLinkOuterPadding more is needed. |
- int delta = popupItems.size() * kLinkLineHeight - kLinkPadding + |
- kLinkOuterPadding; |
+ int delta = |
+ listItems.size() * kLinkLineHeight - kLinkPadding + kLinkOuterPadding; |
NSSize deltaSize = NSMakeSize(0, delta); |
deltaSize = [[[self window] contentView] convertSize:deltaSize toView:nil]; |
NSRect windowFrame = [[self window] frame]; |
windowFrame.size.height += deltaSize.height; |
[[self window] setFrame:windowFrame display:NO]; |
- // Create popup list. |
+ // Create item list. |
int topLinkY = NSMaxY(radioFrame) + delta - kLinkHeight; |
int row = 0; |
- for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator |
- it(popupItems.begin()); it != popupItems.end(); ++it, ++row) { |
+ for (std::vector<ContentSettingBubbleModel::ListItem>::const_iterator |
+ it(listItems.begin()); |
+ it != listItems.end(); ++it, ++row) { |
NSImage* image = it->image.AsNSImage(); |
- |
- std::string title(it->title); |
- // The popup may not have committed a load yet, in which case it won't |
msw
2015/03/20 22:06:33
Why did you remove this? Is this no longer an issu
meacer
2015/03/20 23:39:42
Removed from here as this check is already done at
msw
2015/03/21 00:25:19
Acknowledged.
|
- // have a URL or title. |
- if (title.empty()) |
- title = l10n_util::GetStringUTF8(IDS_TAB_LOADING_TITLE); |
- |
NSRect linkFrame = |
NSMakeRect(NSMinX(radioFrame), topLinkY - kLinkLineHeight * row, |
200, kLinkHeight); |
- NSButton* button = [self |
- hyperlinkButtonWithFrame:linkFrame |
- title:base::SysUTF8ToNSString(title) |
- icon:image |
- referenceFrame:radioFrame]; |
+ NSButton* button = |
+ [self hyperlinkButtonWithFrame:linkFrame |
+ title:base::SysUTF8ToNSString(it->title) |
+ icon:image |
+ referenceFrame:radioFrame]; |
[[self bubble] addSubview:button]; |
popupLinks_[button] = row; |
} |
@@ -748,8 +745,9 @@ class ContentSettingBubbleWebContentsObserverBridge |
if (allowBlockRadioGroup_) // not bound in cookie bubble xib |
[self initializeRadioGroup]; |
- if (type == CONTENT_SETTINGS_TYPE_POPUPS) |
- [self initializePopupList]; |
+ if (type == CONTENT_SETTINGS_TYPE_POPUPS || |
+ type == CONTENT_SETTINGS_TYPE_PLUGINS) |
+ [self initializeItemList]; |
if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) |
[self initializeGeoLists]; |
if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) |
@@ -769,7 +767,7 @@ class ContentSettingBubbleWebContentsObserverBridge |
- (void)popupLinkClicked:(id)sender { |
content_setting_bubble::PopupLinks::iterator i(popupLinks_.find(sender)); |
DCHECK(i != popupLinks_.end()); |
- contentSettingBubbleModel_->OnPopupClicked(i->second); |
+ contentSettingBubbleModel_->OnListItemClicked(i->second); |
} |
- (void)clearGeolocationForCurrentHost:(id)sender { |