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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 windowFrame.size.height += deltaY; | 316 windowFrame.size.height += deltaY; |
317 [[self window] setFrame:windowFrame display:NO]; | 317 [[self window] setFrame:windowFrame display:NO]; |
318 NSRect titleFrame = [titleLabel_ frame]; | 318 NSRect titleFrame = [titleLabel_ frame]; |
319 titleFrame.origin.y -= deltaY; | 319 titleFrame.origin.y -= deltaY; |
320 [titleLabel_ setFrame:titleFrame]; | 320 [titleLabel_ setFrame:titleFrame]; |
321 } | 321 } |
322 | 322 |
323 - (void)initializeRadioGroup { | 323 - (void)initializeRadioGroup { |
324 // NOTE! Tags in the xib files must match the order of the radio buttons | 324 // NOTE! Tags in the xib files must match the order of the radio buttons |
325 // passed in the radio_group and be 1-based, not 0-based. | 325 // passed in the radio_group and be 1-based, not 0-based. |
| 326 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 327 contentSettingBubbleModel_->bubble_content(); |
326 const ContentSettingBubbleModel::RadioGroup& radio_group = | 328 const ContentSettingBubbleModel::RadioGroup& radio_group = |
327 contentSettingBubbleModel_->bubble_content().radio_group; | 329 bubble_content.radio_group; |
328 | 330 |
329 // Xcode 5.1 Interface Builder doesn't allow a font property to be set for | 331 // Xcode 5.1 Interface Builder doesn't allow a font property to be set for |
330 // NSMatrix. The implementation of GTMUILocalizerAndLayoutTweaker assumes that | 332 // NSMatrix. The implementation of GTMUILocalizerAndLayoutTweaker assumes that |
331 // the font for each of the cells in a NSMatrix is identical, and is the font | 333 // the font for each of the cells in a NSMatrix is identical, and is the font |
332 // of the NSMatrix. This logic sets the font of NSMatrix to be that of its | 334 // of the NSMatrix. This logic sets the font of NSMatrix to be that of its |
333 // cells. | 335 // cells. |
334 NSFont* font = nil; | 336 NSFont* font = nil; |
335 for (NSCell* cell in [allowBlockRadioGroup_ cells]) { | 337 for (NSCell* cell in [allowBlockRadioGroup_ cells]) { |
336 if (!font) | 338 if (!font) |
337 font = [cell font]; | 339 font = [cell font]; |
338 DCHECK([font isEqual:[cell font]]); | 340 DCHECK([font isEqual:[cell font]]); |
339 } | 341 } |
340 [allowBlockRadioGroup_ setFont:font]; | 342 [allowBlockRadioGroup_ setFont:font]; |
| 343 [allowBlockRadioGroup_ setEnabled:bubble_content.radio_group_enabled]; |
341 | 344 |
342 // Select appropriate radio button. | 345 // Select appropriate radio button. |
343 [allowBlockRadioGroup_ selectCellWithTag: radio_group.default_item + 1]; | 346 [allowBlockRadioGroup_ selectCellWithTag: radio_group.default_item + 1]; |
344 | 347 |
345 const ContentSettingBubbleModel::RadioItems& radio_items = | 348 const ContentSettingBubbleModel::RadioItems& radio_items = |
346 radio_group.radio_items; | 349 radio_group.radio_items; |
347 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) { |
348 NSCell* radioCell = [allowBlockRadioGroup_ cellWithTag: ii + 1]; | 351 NSCell* radioCell = [allowBlockRadioGroup_ cellWithTag: ii + 1]; |
349 [radioCell setTitle:base::SysUTF8ToNSString(radio_items[ii])]; | 352 [radioCell setTitle:base::SysUTF8ToNSString(radio_items[ii])]; |
350 } | 353 } |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); | 849 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); |
847 | 850 |
848 it->second->model->ExecuteCommand(index, 0); | 851 it->second->model->ExecuteCommand(index, 0); |
849 } | 852 } |
850 | 853 |
851 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { | 854 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { |
852 return &mediaMenus_; | 855 return &mediaMenus_; |
853 } | 856 } |
854 | 857 |
855 @end // ContentSettingBubbleController | 858 @end // ContentSettingBubbleController |
OLD | NEW |