OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/content_settings/content_setting_bubble_cocoa.h
" | 5 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 titleFrame.origin.y -= deltaY; | 322 titleFrame.origin.y -= deltaY; |
323 [titleLabel_ setFrame:titleFrame]; | 323 [titleLabel_ setFrame:titleFrame]; |
324 } | 324 } |
325 | 325 |
326 - (void)initializeRadioGroup { | 326 - (void)initializeRadioGroup { |
327 // NOTE! Tags in the xib files must match the order of the radio buttons | 327 // NOTE! Tags in the xib files must match the order of the radio buttons |
328 // passed in the radio_group and be 1-based, not 0-based. | 328 // passed in the radio_group and be 1-based, not 0-based. |
329 const ContentSettingBubbleModel::RadioGroup& radio_group = | 329 const ContentSettingBubbleModel::RadioGroup& radio_group = |
330 contentSettingBubbleModel_->bubble_content().radio_group; | 330 contentSettingBubbleModel_->bubble_content().radio_group; |
331 | 331 |
| 332 // Xcode 5.1 Interface Builder doesn't allow a font property to be set for |
| 333 // NSMatrix. The implementation of GTMUILocalizerAndLayoutTweaker assumes that |
| 334 // the font for each of the cells in a NSMatrix is identical, and is the font |
| 335 // of the NSMatrix. This logic sets the font of NSMatrix to be that of its |
| 336 // cells. |
| 337 NSFont* font = nil; |
| 338 for (NSCell* cell in [allowBlockRadioGroup_ cells]) { |
| 339 if (!font) |
| 340 font = [cell font]; |
| 341 DCHECK([font isEqual:[cell font]]); |
| 342 } |
| 343 [allowBlockRadioGroup_ setFont:font]; |
| 344 |
332 // Select appropriate radio button. | 345 // Select appropriate radio button. |
333 [allowBlockRadioGroup_ selectCellWithTag: radio_group.default_item + 1]; | 346 [allowBlockRadioGroup_ selectCellWithTag: radio_group.default_item + 1]; |
334 | 347 |
335 const ContentSettingBubbleModel::RadioItems& radio_items = | 348 const ContentSettingBubbleModel::RadioItems& radio_items = |
336 radio_group.radio_items; | 349 radio_group.radio_items; |
337 for (size_t ii = 0; ii < radio_group.radio_items.size(); ++ii) { | 350 for (size_t ii = 0; ii < radio_group.radio_items.size(); ++ii) { |
338 NSCell* radioCell = [allowBlockRadioGroup_ cellWithTag: ii + 1]; | 351 NSCell* radioCell = [allowBlockRadioGroup_ cellWithTag: ii + 1]; |
339 [radioCell setTitle:base::SysUTF8ToNSString(radio_items[ii])]; | 352 [radioCell setTitle:base::SysUTF8ToNSString(radio_items[ii])]; |
340 } | 353 } |
341 | 354 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); | 839 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); |
827 | 840 |
828 it->second->model->ExecuteCommand(index, 0); | 841 it->second->model->ExecuteCommand(index, 0); |
829 } | 842 } |
830 | 843 |
831 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { | 844 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { |
832 return &mediaMenus_; | 845 return &mediaMenus_; |
833 } | 846 } |
834 | 847 |
835 @end // ContentSettingBubbleController | 848 @end // ContentSettingBubbleController |
OLD | NEW |