Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1213)

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm

Issue 2585953002: [UI Cocoa] Hide the global error bubble icon from accessibility (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/global_error_bubble_controller.mm ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 #include "components/strings/grit/components_chromium_strings.h" 30 #include "components/strings/grit/components_chromium_strings.h"
31 #include "components/strings/grit/components_strings.h" 31 #include "components/strings/grit/components_strings.h"
32 #include "content/public/browser/page_navigator.h" 32 #include "content/public/browser/page_navigator.h"
33 #include "content/public/browser/ssl_host_state_delegate.h" 33 #include "content/public/browser/ssl_host_state_delegate.h"
34 #include "content/public/browser/user_metrics.h" 34 #include "content/public/browser/user_metrics.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "content/public/common/url_constants.h" 36 #include "content/public/common/url_constants.h"
37 #include "extensions/common/constants.h" 37 #include "extensions/common/constants.h"
38 #include "skia/ext/skia_utils_mac.h" 38 #include "skia/ext/skia_utils_mac.h"
39 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" 39 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
40 #import "ui/base/cocoa/a11y_util.h"
40 #include "ui/base/cocoa/cocoa_base_utils.h" 41 #include "ui/base/cocoa/cocoa_base_utils.h"
41 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" 42 #import "ui/base/cocoa/controls/hyperlink_button_cell.h"
42 #import "ui/base/cocoa/flipped_view.h" 43 #import "ui/base/cocoa/flipped_view.h"
43 #import "ui/base/cocoa/hover_image_button.h" 44 #import "ui/base/cocoa/hover_image_button.h"
44 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
45 #include "ui/base/material_design/material_design_controller.h" 46 #include "ui/base/material_design/material_design_controller.h"
46 #include "ui/base/resource/resource_bundle.h" 47 #include "ui/base/resource/resource_bundle.h"
47 #import "ui/gfx/mac/coordinate_conversion.h" 48 #import "ui/gfx/mac/coordinate_conversion.h"
48 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" 49 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
49 #include "ui/resources/grit/ui_resources.h" 50 #include "ui/resources/grit/ui_resources.h"
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // Add an image as a subview of the given view, placed at a pre-determined x 607 // Add an image as a subview of the given view, placed at a pre-determined x
607 // position and the given y position. The image is not in the accessibility 608 // position and the given y position. The image is not in the accessibility
608 // order, since the image is always accompanied by text in this bubble. Return 609 // order, since the image is always accompanied by text in this bubble. Return
609 // the new NSImageView. 610 // the new NSImageView.
610 - (NSImageView*)addImageWithSize:(NSSize)size 611 - (NSImageView*)addImageWithSize:(NSSize)size
611 toView:(NSView*)view 612 toView:(NSView*)view
612 atPoint:(NSPoint)point { 613 atPoint:(NSPoint)point {
613 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height); 614 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height);
614 base::scoped_nsobject<NSImageView> imageView( 615 base::scoped_nsobject<NSImageView> imageView(
615 [[NSImageView alloc] initWithFrame:frame]); 616 [[NSImageView alloc] initWithFrame:frame]);
616 [self hideImageFromAccessibilityOrder:imageView]; 617 ui::a11y_util::HideImageFromAccessibilityOrder(imageView);
617 [imageView setImageFrameStyle:NSImageFrameNone]; 618 [imageView setImageFrameStyle:NSImageFrameNone];
618 [view addSubview:imageView.get()]; 619 [view addSubview:imageView.get()];
619 return imageView.get(); 620 return imageView.get();
620 } 621 }
621 622
622 // Hide the given image view from the accessibility order for VoiceOver.
623 - (void)hideImageFromAccessibilityOrder:(NSImageView*)imageView {
624 // This is the minimum change necessary to get VoiceOver to skip the image
625 // (instead of reading the word "image"). Accessibility mechanisms in OSX
626 // change once in a while, so this may be fragile.
627 [[imageView cell] accessibilitySetOverrideValue:@""
628 forAttribute:NSAccessibilityRoleAttribute];
629 }
630
631 // Add a separator as a subview of the given view. Return the new view. 623 // Add a separator as a subview of the given view. Return the new view.
632 - (NSView*)addSeparatorToView:(NSView*)view { 624 - (NSView*)addSeparatorToView:(NSView*)view {
633 // Use an arbitrary position; it will be adjusted in performLayout. 625 // Use an arbitrary position; it will be adjusted in performLayout.
634 NSBox* spacer = [self 626 NSBox* spacer = [self
635 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; 627 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)];
636 [view addSubview:spacer]; 628 [view addSubview:spacer];
637 return spacer; 629 return spacer;
638 } 630 }
639 631
640 // Add a link button with the given text to |view|. 632 // Add a link button with the given text to |view|.
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 void WebsiteSettingsUIBridge::SetPermissionInfo( 1207 void WebsiteSettingsUIBridge::SetPermissionInfo(
1216 const PermissionInfoList& permission_info_list, 1208 const PermissionInfoList& permission_info_list,
1217 ChosenObjectInfoList chosen_object_info_list) { 1209 ChosenObjectInfoList chosen_object_info_list) {
1218 [bubble_controller_ setPermissionInfo:permission_info_list 1210 [bubble_controller_ setPermissionInfo:permission_info_list
1219 andChosenObjects:std::move(chosen_object_info_list)]; 1211 andChosenObjects:std::move(chosen_object_info_list)];
1220 } 1212 }
1221 1213
1222 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { 1214 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) {
1223 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) 1215 // TODO(lgarron): Remove this from the interface. (crbug.com/571533)
1224 } 1216 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/global_error_bubble_controller.mm ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698