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

Unified Diff: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm

Issue 10782038: Revert 147045 - Bring up a content settings icon for ungestured registerProtocolHandler call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/content_settings/content_setting_bubble_cocoa.mm
===================================================================
--- chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm (revision 147078)
+++ chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm (working copy)
@@ -23,6 +23,12 @@
namespace {
+// Must match the tag of the unblock radio button in the xib files.
+const int kAllowTag = 1;
+
+// Must match the tag of the block radio button in the xib files.
+const int kBlockTag = 2;
+
// Height of one link in the popup list.
const int kLinkHeight = 16;
@@ -131,8 +137,6 @@
nibPath = @"ContentBlockedGeolocation"; break;
case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT:
nibPath = @"ContentBlockedMixedScript"; break;
- case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS:
- nibPath = @"ContentProtocolHandlers"; break;
default:
NOTREACHED();
}
@@ -165,21 +169,25 @@
}
- (void)initializeRadioGroup {
- // NOTE! Tags in the xib files must match the order of the radio buttons
- // passed in the radio_group and be 1-based, not 0-based.
+ // 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 + 1];
+ [allowBlockRadioGroup_ selectCellWithTag:
+ radio_group.default_item == 0 ? kAllowTag : kBlockTag];
const ContentSettingBubbleModel::RadioItems& radio_items =
radio_group.radio_items;
- for (size_t ii = 0; ii < radio_group.radio_items.size(); ++ii) {
- NSCell* radioCell = [allowBlockRadioGroup_ cellWithTag: ii + 1];
- [radioCell setTitle:base::SysUTF8ToNSString(radio_items[ii])];
- }
+ DCHECK_EQ(2u, radio_items.size()) << "Only 2 radio items per group supported";
+ // Set radio group labels from model.
+ NSCell* radioCell = [allowBlockRadioGroup_ cellWithTag:kAllowTag];
+ [radioCell setTitle:base::SysUTF8ToNSString(radio_items[0])];
+ radioCell = [allowBlockRadioGroup_ cellWithTag:kBlockTag];
+ [radioCell setTitle:base::SysUTF8ToNSString(radio_items[1])];
+
// Layout radio group labels post-localization.
[GTMUILocalizerAndLayoutTweaker
wrapRadioGroupForWidth:allowBlockRadioGroup_];
@@ -438,7 +446,6 @@
[self sizeToFitLoadButton];
[self initializeBlockedPluginsList];
}
-
if (allowBlockRadioGroup_) // not bound in cookie bubble xib
[self initializeRadioGroup];
@@ -453,7 +460,8 @@
- (IBAction)allowBlockToggled:(id)sender {
NSButtonCell *selectedCell = [sender selectedCell];
- contentSettingBubbleModel_->OnRadioClicked([selectedCell tag] - 1);
+ contentSettingBubbleModel_->OnRadioClicked(
+ [selectedCell tag] == kAllowTag ? 0 : 1);
}
- (void)popupLinkClicked:(id)sender {

Powered by Google App Engine
This is Rietveld 408576698