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

Side by Side Diff: ui/message_center/cocoa/notification_controller.mm

Issue 333643007: Fix progress bar indicator for accessibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: progress accessibility: CR comments per rsesek and dewittj Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/message_center/cocoa/notification_controller.h" 5 #import "ui/message_center/cocoa/notification_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 if (progressFraction == 0.0) 45 if (progressFraction == 0.0)
46 return; 46 return;
47 47
48 path = [NSBezierPath bezierPathWithRoundedRect:sliceRect 48 path = [NSBezierPath bezierPathWithRoundedRect:sliceRect
49 xRadius:message_center::kProgressBarCornerRadius 49 xRadius:message_center::kProgressBarCornerRadius
50 yRadius:message_center::kProgressBarCornerRadius]; 50 yRadius:message_center::kProgressBarCornerRadius];
51 [gfx::SkColorToCalibratedNSColor(message_center::kProgressBarSliceColor) set]; 51 [gfx::SkColorToCalibratedNSColor(message_center::kProgressBarSliceColor) set];
52 [path fill]; 52 [path fill];
53 } 53 }
54
55 - (id)accessibilityAttributeValue:(NSString*)attribute {
56 double progressValue = 0.0;
57 if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) {
58 progressValue = [self doubleValue];
59 } else if ([attribute isEqualToString:NSAccessibilityMinValueAttribute]) {
60 progressValue = [self minValue];
61 } else if ([attribute isEqualToString:NSAccessibilityMaxValueAttribute]) {
62 progressValue = [self maxValue];
63 } else {
64 return [super accessibilityAttributeValue:attribute];
65 }
66
67 return [NSString stringWithFormat:@"%lf", progressValue];
68 }
54 @end 69 @end
55 70
56 //////////////////////////////////////////////////////////////////////////////// 71 ////////////////////////////////////////////////////////////////////////////////
57 @interface MCNotificationButton : NSButton 72 @interface MCNotificationButton : NSButton
58 @end 73 @end
59 74
60 @implementation MCNotificationButton 75 @implementation MCNotificationButton
61 // drawRect: needs to fill the button with a background, otherwise we don't get 76 // drawRect: needs to fill the button with a background, otherwise we don't get
62 // subpixel antialiasing. 77 // subpixel antialiasing.
63 - (void)drawRect:(NSRect)dirtyRect { 78 - (void)drawRect:(NSRect)dirtyRect {
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 forFont:(NSFont*)nsfont 861 forFont:(NSFont*)nsfont
847 maxNumberOfLines:(size_t)lines { 862 maxNumberOfLines:(size_t)lines {
848 size_t unused; 863 size_t unused;
849 return [self wrapText:text 864 return [self wrapText:text
850 forFont:nsfont 865 forFont:nsfont
851 maxNumberOfLines:lines 866 maxNumberOfLines:lines
852 actualLines:&unused]; 867 actualLines:&unused];
853 } 868 }
854 869
855 @end 870 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698