| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tabs/tab_strip_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 6 | 6 |
| 7 #include <cmath> // floor | 7 #include <cmath> // floor |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // (URLDropTarget protocol) | 204 // (URLDropTarget protocol) |
| 205 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 205 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
| 206 return [dropHandler_ performDragOperation:sender]; | 206 return [dropHandler_ performDragOperation:sender]; |
| 207 } | 207 } |
| 208 | 208 |
| 209 - (BOOL)accessibilityIsIgnored { | 209 - (BOOL)accessibilityIsIgnored { |
| 210 return NO; | 210 return NO; |
| 211 } | 211 } |
| 212 | 212 |
| 213 // Returns AX children (tabs and new tab button), sorted from left to right. | 213 // Returns AX children (tabs and new tab button), sorted from left to right. |
| 214 - (NSArray*)accessibilityChildren { | 214 - (NSArray*)tabStripViewAccessibilityChildren { |
| 215 NSArray* children = | 215 NSArray* children = |
| 216 [super accessibilityAttributeValue:NSAccessibilityChildrenAttribute]; | 216 [super accessibilityAttributeValue:NSAccessibilityChildrenAttribute]; |
| 217 return [children sortedArrayUsingComparator: | 217 return [children sortedArrayUsingComparator: |
| 218 ^NSComparisonResult(id first, id second) { | 218 ^NSComparisonResult(id first, id second) { |
| 219 NSPoint firstPosition = | 219 NSPoint firstPosition = |
| 220 [[first accessibilityAttributeValue: | 220 [[first accessibilityAttributeValue: |
| 221 NSAccessibilityPositionAttribute] pointValue]; | 221 NSAccessibilityPositionAttribute] pointValue]; |
| 222 NSPoint secondPosition = | 222 NSPoint secondPosition = |
| 223 [[second accessibilityAttributeValue: | 223 [[second accessibilityAttributeValue: |
| 224 NSAccessibilityPositionAttribute] pointValue]; | 224 NSAccessibilityPositionAttribute] pointValue]; |
| 225 if (firstPosition.x < secondPosition.x) | 225 if (firstPosition.x < secondPosition.x) |
| 226 return NSOrderedAscending; | 226 return NSOrderedAscending; |
| 227 else if (firstPosition.x > secondPosition.x) | 227 else if (firstPosition.x > secondPosition.x) |
| 228 return NSOrderedDescending; | 228 return NSOrderedDescending; |
| 229 else | 229 else |
| 230 return NSOrderedSame; | 230 return NSOrderedSame; |
| 231 }]; | 231 }]; |
| 232 } | 232 } |
| 233 | 233 |
| 234 - (id)accessibilityAttributeValue:(NSString*)attribute { | 234 - (id)accessibilityAttributeValue:(NSString*)attribute { |
| 235 if ([attribute isEqual:NSAccessibilityRoleAttribute]) { | 235 if ([attribute isEqual:NSAccessibilityRoleAttribute]) { |
| 236 return NSAccessibilityTabGroupRole; | 236 return NSAccessibilityTabGroupRole; |
| 237 } else if ([attribute isEqual:NSAccessibilityChildrenAttribute]) { | 237 } else if ([attribute isEqual:NSAccessibilityChildrenAttribute]) { |
| 238 return [self accessibilityChildren]; | 238 return [self tabStripViewAccessibilityChildren]; |
| 239 } else if ([attribute isEqual:NSAccessibilityTabsAttribute]) { | 239 } else if ([attribute isEqual:NSAccessibilityTabsAttribute]) { |
| 240 NSArray* children = [self accessibilityChildren]; | 240 NSArray* children = [self tabStripViewAccessibilityChildren]; |
| 241 NSIndexSet* indexes = [children indexesOfObjectsPassingTest: | 241 NSIndexSet* indexes = [children indexesOfObjectsPassingTest: |
| 242 ^BOOL(id child, NSUInteger idx, BOOL* stop) { | 242 ^BOOL(id child, NSUInteger idx, BOOL* stop) { |
| 243 NSString* role = [child | 243 NSString* role = [child |
| 244 accessibilityAttributeValue:NSAccessibilityRoleAttribute]; | 244 accessibilityAttributeValue:NSAccessibilityRoleAttribute]; |
| 245 return [role isEqualToString:NSAccessibilityRadioButtonRole]; | 245 return [role isEqualToString:NSAccessibilityRadioButtonRole]; |
| 246 }]; | 246 }]; |
| 247 return [children objectsAtIndexes:indexes]; | 247 return [children objectsAtIndexes:indexes]; |
| 248 } else if ([attribute isEqual:NSAccessibilityContentsAttribute]) { | 248 } else if ([attribute isEqual:NSAccessibilityContentsAttribute]) { |
| 249 return [self accessibilityChildren]; | 249 return [self tabStripViewAccessibilityChildren]; |
| 250 } else if ([attribute isEqual:NSAccessibilityValueAttribute]) { | 250 } else if ([attribute isEqual:NSAccessibilityValueAttribute]) { |
| 251 return [controller_ activeTabView]; | 251 return [controller_ activeTabView]; |
| 252 } | 252 } |
| 253 | 253 |
| 254 return [super accessibilityAttributeValue:attribute]; | 254 return [super accessibilityAttributeValue:attribute]; |
| 255 } | 255 } |
| 256 | 256 |
| 257 - (NSArray*)accessibilityAttributeNames { | 257 - (NSArray*)accessibilityAttributeNames { |
| 258 NSMutableArray* attributes = | 258 NSMutableArray* attributes = |
| 259 [[super accessibilityAttributeNames] mutableCopy]; | 259 [[super accessibilityAttributeNames] mutableCopy]; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 284 | 284 |
| 285 - (void)windowDidChangeTheme { | 285 - (void)windowDidChangeTheme { |
| 286 [self setNeedsDisplay:YES]; | 286 [self setNeedsDisplay:YES]; |
| 287 } | 287 } |
| 288 | 288 |
| 289 - (void)windowDidChangeActive { | 289 - (void)windowDidChangeActive { |
| 290 [self setNeedsDisplay:YES]; | 290 [self setNeedsDisplay:YES]; |
| 291 } | 291 } |
| 292 | 292 |
| 293 @end | 293 @end |
| OLD | NEW |