| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 webContents:(content::WebContents*)webContents | 205 webContents:(content::WebContents*)webContents |
| 206 parentWindow:(NSWindow*)parentWindow | 206 parentWindow:(NSWindow*)parentWindow |
| 207 anchoredAt:(NSPoint)anchoredAt; | 207 anchoredAt:(NSPoint)anchoredAt; |
| 208 - (NSString*)getNibPathForModel:(ContentSettingBubbleModel*)model; | 208 - (NSString*)getNibPathForModel:(ContentSettingBubbleModel*)model; |
| 209 - (NSButton*)hyperlinkButtonWithFrame:(NSRect)frame | 209 - (NSButton*)hyperlinkButtonWithFrame:(NSRect)frame |
| 210 title:(NSString*)title | 210 title:(NSString*)title |
| 211 icon:(NSImage*)icon | 211 icon:(NSImage*)icon |
| 212 referenceFrame:(NSRect)referenceFrame; | 212 referenceFrame:(NSRect)referenceFrame; |
| 213 - (void)initializeBlockedPluginsList; | 213 - (void)initializeBlockedPluginsList; |
| 214 - (void)initializeTitle; | 214 - (void)initializeTitle; |
| 215 - (void)initializeMessage; |
| 215 - (void)initializeRadioGroup; | 216 - (void)initializeRadioGroup; |
| 216 - (void)initializeItemList; | 217 - (void)initializeItemList; |
| 217 - (void)initializeGeoLists; | 218 - (void)initializeGeoLists; |
| 218 - (void)initializeMediaMenus; | 219 - (void)initializeMediaMenus; |
| 219 - (void)initializeMIDISysExLists; | 220 - (void)initializeMIDISysExLists; |
| 220 - (void)sizeToFitLoadButton; | 221 - (void)sizeToFitLoadButton; |
| 221 - (void)initManageDoneButtons; | 222 - (void)initManageDoneButtons; |
| 222 - (void)removeInfoButton; | 223 - (void)removeInfoButton; |
| 223 - (void)popupLinkClicked:(id)sender; | 224 - (void)popupLinkClicked:(id)sender; |
| 224 - (void)clearGeolocationForCurrentHost:(id)sender; | 225 - (void)clearGeolocationForCurrentHost:(id)sender; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 CGFloat deltaY = [GTMUILocalizerAndLayoutTweaker | 323 CGFloat deltaY = [GTMUILocalizerAndLayoutTweaker |
| 323 sizeToFitFixedWidthTextField:titleLabel_]; | 324 sizeToFitFixedWidthTextField:titleLabel_]; |
| 324 NSRect windowFrame = [[self window] frame]; | 325 NSRect windowFrame = [[self window] frame]; |
| 325 windowFrame.size.height += deltaY; | 326 windowFrame.size.height += deltaY; |
| 326 [[self window] setFrame:windowFrame display:NO]; | 327 [[self window] setFrame:windowFrame display:NO]; |
| 327 NSRect titleFrame = [titleLabel_ frame]; | 328 NSRect titleFrame = [titleLabel_ frame]; |
| 328 titleFrame.origin.y -= deltaY; | 329 titleFrame.origin.y -= deltaY; |
| 329 [titleLabel_ setFrame:titleFrame]; | 330 [titleLabel_ setFrame:titleFrame]; |
| 330 } | 331 } |
| 331 | 332 |
| 333 - (void)initializeMessage { |
| 334 if (!messageLabel_) |
| 335 return; |
| 336 |
| 337 NSString* label = base::SysUTF16ToNSString( |
| 338 contentSettingBubbleModel_->bubble_content().message); |
| 339 [messageLabel_ setStringValue:label]; |
| 340 |
| 341 CGFloat deltaY = [GTMUILocalizerAndLayoutTweaker |
| 342 sizeToFitFixedWidthTextField:messageLabel_]; |
| 343 NSRect windowFrame = [[self window] frame]; |
| 344 windowFrame.size.height += deltaY; |
| 345 [[self window] setFrame:windowFrame display:NO]; |
| 346 NSRect messageFrame = [messageLabel_ frame]; |
| 347 messageFrame.origin.y -= deltaY; |
| 348 [messageLabel_ setFrame:messageFrame]; |
| 349 } |
| 350 |
| 332 - (void)initializeRadioGroup { | 351 - (void)initializeRadioGroup { |
| 333 // NOTE! Tags in the xib files must match the order of the radio buttons | 352 // NOTE! Tags in the xib files must match the order of the radio buttons |
| 334 // passed in the radio_group and be 1-based, not 0-based. | 353 // passed in the radio_group and be 1-based, not 0-based. |
| 335 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 354 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 336 contentSettingBubbleModel_->bubble_content(); | 355 contentSettingBubbleModel_->bubble_content(); |
| 337 const ContentSettingBubbleModel::RadioGroup& radio_group = | 356 const ContentSettingBubbleModel::RadioGroup& radio_group = |
| 338 bubble_content.radio_group; | 357 bubble_content.radio_group; |
| 339 | 358 |
| 340 // Xcode 5.1 Interface Builder doesn't allow a font property to be set for | 359 // Xcode 5.1 Interface Builder doesn't allow a font property to be set for |
| 341 // NSMatrix. The implementation of GTMUILocalizerAndLayoutTweaker assumes that | 360 // NSMatrix. The implementation of GTMUILocalizerAndLayoutTweaker assumes that |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 | 781 |
| 763 - (void)awakeFromNib { | 782 - (void)awakeFromNib { |
| 764 [super awakeFromNib]; | 783 [super awakeFromNib]; |
| 765 | 784 |
| 766 [[self bubble] setArrowLocation:info_bubble::kTopRight]; | 785 [[self bubble] setArrowLocation:info_bubble::kTopRight]; |
| 767 | 786 |
| 768 // Adapt window size to bottom buttons. Do this before all other layouting. | 787 // Adapt window size to bottom buttons. Do this before all other layouting. |
| 769 [self initManageDoneButtons]; | 788 [self initManageDoneButtons]; |
| 770 | 789 |
| 771 [self initializeTitle]; | 790 [self initializeTitle]; |
| 791 [self initializeMessage]; |
| 772 | 792 |
| 773 // Note that the per-content-type methods and |initializeRadioGroup| below | 793 // Note that the per-content-type methods and |initializeRadioGroup| below |
| 774 // must be kept in the correct order, as they make interdependent adjustments | 794 // must be kept in the correct order, as they make interdependent adjustments |
| 775 // of the bubble's height. | 795 // of the bubble's height. |
| 776 ContentSettingSimpleBubbleModel* simple_bubble = | 796 ContentSettingSimpleBubbleModel* simple_bubble = |
| 777 contentSettingBubbleModel_->AsSimpleBubbleModel(); | 797 contentSettingBubbleModel_->AsSimpleBubbleModel(); |
| 778 if (simple_bubble && | 798 if (simple_bubble && |
| 779 simple_bubble->content_type() == CONTENT_SETTINGS_TYPE_PLUGINS) { | 799 simple_bubble->content_type() == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 780 [self sizeToFitLoadButton]; | 800 [self sizeToFitLoadButton]; |
| 781 [self initializeBlockedPluginsList]; | 801 [self initializeBlockedPluginsList]; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); | 878 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); |
| 859 | 879 |
| 860 it->second->model->ExecuteCommand(index, 0); | 880 it->second->model->ExecuteCommand(index, 0); |
| 861 } | 881 } |
| 862 | 882 |
| 863 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { | 883 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { |
| 864 return &mediaMenus_; | 884 return &mediaMenus_; |
| 865 } | 885 } |
| 866 | 886 |
| 867 @end // ContentSettingBubbleController | 887 @end // ContentSettingBubbleController |
| OLD | NEW |