OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |