| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/website_settings/website_settings_bubble_contro
ller.h" | 5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro
ller.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize] | 613 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize] |
| 614 : [NSFont systemFontOfSize:fontSize]; | 614 : [NSFont systemFontOfSize:fontSize]; |
| 615 [textField setFont:font]; | 615 [textField setFont:font]; |
| 616 [self sizeTextFieldHeightToFit:textField]; | 616 [self sizeTextFieldHeightToFit:textField]; |
| 617 [textField setAutoresizingMask:NSViewWidthSizable]; | 617 [textField setAutoresizingMask:NSViewWidthSizable]; |
| 618 [view addSubview:textField.get()]; | 618 [view addSubview:textField.get()]; |
| 619 return textField.get(); | 619 return textField.get(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 // Add an image as a subview of the given view, placed at a pre-determined x | 622 // Add an image as a subview of the given view, placed at a pre-determined x |
| 623 // position and the given y position. Return the new NSImageView. | 623 // position and the given y position. The image is not in the accessibility |
| 624 // order, since the image is always accompanied by text in this bubble. Return |
| 625 // the new NSImageView. |
| 624 - (NSImageView*)addImageWithSize:(NSSize)size | 626 - (NSImageView*)addImageWithSize:(NSSize)size |
| 625 toView:(NSView*)view | 627 toView:(NSView*)view |
| 626 atPoint:(NSPoint)point { | 628 atPoint:(NSPoint)point { |
| 627 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height); | 629 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height); |
| 628 base::scoped_nsobject<NSImageView> imageView( | 630 base::scoped_nsobject<NSImageView> imageView( |
| 629 [[NSImageView alloc] initWithFrame:frame]); | 631 [[NSImageView alloc] initWithFrame:frame]); |
| 632 [self hideImageFromAccessibilityOrder:imageView]; |
| 630 [imageView setImageFrameStyle:NSImageFrameNone]; | 633 [imageView setImageFrameStyle:NSImageFrameNone]; |
| 631 [view addSubview:imageView.get()]; | 634 [view addSubview:imageView.get()]; |
| 632 return imageView.get(); | 635 return imageView.get(); |
| 633 } | 636 } |
| 634 | 637 |
| 638 // Hide the given image view from the accessibility order for VoiceOver. |
| 639 - (void)hideImageFromAccessibilityOrder:(NSImageView*)imageView { |
| 640 // This is the minimum change necessary to get VoiceOver to skip the image |
| 641 // (instead of reading the word "image"). Accessibility mechanisms in OSX |
| 642 // change once in a while, so this may be fragile. |
| 643 [[imageView cell] accessibilitySetOverrideValue:@"" |
| 644 forAttribute:NSAccessibilityRoleAttribute]; |
| 645 } |
| 646 |
| 635 // Add a separator as a subview of the given view. Return the new view. | 647 // Add a separator as a subview of the given view. Return the new view. |
| 636 - (NSView*)addSeparatorToView:(NSView*)view { | 648 - (NSView*)addSeparatorToView:(NSView*)view { |
| 637 // Use an arbitrary position; it will be adjusted in performLayout. | 649 // Use an arbitrary position; it will be adjusted in performLayout. |
| 638 NSBox* spacer = [self | 650 NSBox* spacer = [self |
| 639 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; | 651 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; |
| 640 [view addSubview:spacer]; | 652 [view addSubview:spacer]; |
| 641 return spacer; | 653 return spacer; |
| 642 } | 654 } |
| 643 | 655 |
| 644 // Add a link button with the given text to |view|. | 656 // Add a link button with the given text to |view|. |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1235 void WebsiteSettingsUIBridge::SetPermissionInfo( |
| 1224 const PermissionInfoList& permission_info_list, | 1236 const PermissionInfoList& permission_info_list, |
| 1225 const ChosenObjectInfoList& chosen_object_info_list) { | 1237 const ChosenObjectInfoList& chosen_object_info_list) { |
| 1226 [bubble_controller_ setPermissionInfo:permission_info_list | 1238 [bubble_controller_ setPermissionInfo:permission_info_list |
| 1227 andChosenObjects:chosen_object_info_list]; | 1239 andChosenObjects:chosen_object_info_list]; |
| 1228 } | 1240 } |
| 1229 | 1241 |
| 1230 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1242 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
| 1231 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) | 1243 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) |
| 1232 } | 1244 } |
| OLD | NEW |