| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize] | 612 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize] |
| 613 : [NSFont systemFontOfSize:fontSize]; | 613 : [NSFont systemFontOfSize:fontSize]; |
| 614 [textField setFont:font]; | 614 [textField setFont:font]; |
| 615 [self sizeTextFieldHeightToFit:textField]; | 615 [self sizeTextFieldHeightToFit:textField]; |
| 616 [textField setAutoresizingMask:NSViewWidthSizable]; | 616 [textField setAutoresizingMask:NSViewWidthSizable]; |
| 617 [view addSubview:textField.get()]; | 617 [view addSubview:textField.get()]; |
| 618 return textField.get(); | 618 return textField.get(); |
| 619 } | 619 } |
| 620 | 620 |
| 621 // Add an image as a subview of the given view, placed at a pre-determined x | 621 // Add an image as a subview of the given view, placed at a pre-determined x |
| 622 // position and the given y position. Return the new NSImageView. | 622 // position and the given y position. The image is not in the accessibility |
| 623 // order, since the image is always accompanied by text in this bubble. Return |
| 624 // the new NSImageView. |
| 623 - (NSImageView*)addImageWithSize:(NSSize)size | 625 - (NSImageView*)addImageWithSize:(NSSize)size |
| 624 toView:(NSView*)view | 626 toView:(NSView*)view |
| 625 atPoint:(NSPoint)point { | 627 atPoint:(NSPoint)point { |
| 626 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height); | 628 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height); |
| 627 base::scoped_nsobject<NSImageView> imageView( | 629 base::scoped_nsobject<NSImageView> imageView( |
| 628 [[NSImageView alloc] initWithFrame:frame]); | 630 [[NSImageView alloc] initWithFrame:frame]); |
| 631 [self hideImageFromAccessibilityOrder:imageView]; |
| 629 [imageView setImageFrameStyle:NSImageFrameNone]; | 632 [imageView setImageFrameStyle:NSImageFrameNone]; |
| 630 [view addSubview:imageView.get()]; | 633 [view addSubview:imageView.get()]; |
| 631 return imageView.get(); | 634 return imageView.get(); |
| 632 } | 635 } |
| 633 | 636 |
| 637 // Hide the given image view from the accessibility order for VoiceOver. |
| 638 - (void)hideImageFromAccessibilityOrder:(NSImageView*)imageView { |
| 639 // This is the minimum change necessary to get VoiceOver to skip the image |
| 640 // (instead of reading the word "image"). Accessibility mechanisms in OSX |
| 641 // change once in a while, so this may be fragile. |
| 642 [[imageView cell] accessibilitySetOverrideValue:@"" |
| 643 forAttribute:NSAccessibilityRoleAttribute]; |
| 644 } |
| 645 |
| 634 // Add a separator as a subview of the given view. Return the new view. | 646 // Add a separator as a subview of the given view. Return the new view. |
| 635 - (NSView*)addSeparatorToView:(NSView*)view { | 647 - (NSView*)addSeparatorToView:(NSView*)view { |
| 636 // Use an arbitrary position; it will be adjusted in performLayout. | 648 // Use an arbitrary position; it will be adjusted in performLayout. |
| 637 NSBox* spacer = [self | 649 NSBox* spacer = [self |
| 638 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; | 650 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; |
| 639 [view addSubview:spacer]; | 651 [view addSubview:spacer]; |
| 640 return spacer; | 652 return spacer; |
| 641 } | 653 } |
| 642 | 654 |
| 643 // Add a link button with the given text to |view|. | 655 // Add a link button with the given text to |view|. |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1211 void WebsiteSettingsUIBridge::SetPermissionInfo( |
| 1200 const PermissionInfoList& permission_info_list, | 1212 const PermissionInfoList& permission_info_list, |
| 1201 ChosenObjectInfoList chosen_object_info_list) { | 1213 ChosenObjectInfoList chosen_object_info_list) { |
| 1202 [bubble_controller_ setPermissionInfo:permission_info_list | 1214 [bubble_controller_ setPermissionInfo:permission_info_list |
| 1203 andChosenObjects:std::move(chosen_object_info_list)]; | 1215 andChosenObjects:std::move(chosen_object_info_list)]; |
| 1204 } | 1216 } |
| 1205 | 1217 |
| 1206 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1218 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
| 1207 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) | 1219 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) |
| 1208 } | 1220 } |
| OLD | NEW |