Chromium Code Reviews| 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 8e96c6d70202cdc248a65c34074141756fd22c99..779ecef91b12c2843999a3443e68252e5c44bf25 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 | 
| @@ -93,6 +93,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) { | 
| - (void)initializeRadioGroup; | 
| - (void)initializePopupList; | 
| - (void)initializeGeoLists; | 
| +- (void)initializeProtocolHandlers; | 
| - (void)sizeToFitLoadButton; | 
| - (void)sizeToFitManageDoneButtons; | 
| - (void)removeInfoButton; | 
| @@ -137,6 +138,8 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) { | 
| nibPath = @"ContentBlockedGeolocation"; break; | 
| case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT: | 
| nibPath = @"ContentBlockedMixedScript"; break; | 
| + case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS: | 
| + nibPath = @"ContentProtocolHandlers"; break; | 
| default: | 
| NOTREACHED(); | 
| } | 
| @@ -400,6 +403,34 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) { | 
| [contentsContainer_ setFrame:containerFrame]; | 
| } | 
| +- (void)initializeProtocolHandlers { | 
| 
 
Bernhard Bauer
2012/07/02 23:13:15
I think you could generalize |initializeRadioGroup
 
Greg Billock
2012/07/03 20:33:03
Done.
 
 | 
| + // Configure the radio group. For now, only deal with the | 
| + // strictly needed case of group containing 2 radio buttons. | 
| + const ContentSettingBubbleModel::RadioGroup& radio_group = | 
| + contentSettingBubbleModel_->bubble_content().radio_group; | 
| + | 
| + // Select appropriate radio button. | 
| + [allowBlockRadioGroup_ selectCellWithTag: radio_group.default_item]; | 
| + | 
| + const ContentSettingBubbleModel::RadioItems& radio_items = | 
| + radio_group.radio_items; | 
| + // Set radio group labels from model. | 
| + for (size_t ii = 0; ii < radio_group.radio_items.size(); ++ii) { | 
| + NSCell* radioCell = [allowBlockRadioGroup_ cellAtRow:ii column:0]; | 
| + [radioCell setTitle:base::SysUTF8ToNSString(radio_items[0])]; | 
| + } | 
| + | 
| + // Layout radio group labels post-localization. | 
| + [GTMUILocalizerAndLayoutTweaker | 
| + wrapRadioGroupForWidth:allowBlockRadioGroup_]; | 
| + CGFloat radioDeltaY = [GTMUILocalizerAndLayoutTweaker | 
| + sizeToFitView:allowBlockRadioGroup_].height; | 
| + NSRect windowFrame = [[self window] frame]; | 
| + windowFrame.size.height += radioDeltaY; | 
| + [[self window] setFrame:windowFrame display:NO]; | 
| +} | 
| + | 
| + | 
| - (void)sizeToFitLoadButton { | 
| const ContentSettingBubbleModel::BubbleContent& content = | 
| contentSettingBubbleModel_->bubble_content(); | 
| @@ -446,6 +477,12 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) { | 
| [self sizeToFitLoadButton]; | 
| [self initializeBlockedPluginsList]; | 
| } | 
| + | 
| + if (type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) { | 
| + [self initializeProtocolHandlers]; | 
| + return; | 
| + } | 
| + | 
| if (allowBlockRadioGroup_) // not bound in cookie bubble xib | 
| [self initializeRadioGroup]; | 
| @@ -460,8 +497,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) { | 
| - (IBAction)allowBlockToggled:(id)sender { | 
| NSButtonCell *selectedCell = [sender selectedCell]; | 
| - contentSettingBubbleModel_->OnRadioClicked( | 
| - [selectedCell tag] == kAllowTag ? 0 : 1); | 
| + contentSettingBubbleModel_->OnRadioClicked([selectedCell tag] - 1); | 
| } | 
| - (void)popupLinkClicked:(id)sender { |