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 "ios/chrome/browser/ui/stack_view/title_label.h" | 5 #import "ios/chrome/browser/ui/stack_view/title_label.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
10 #error "This file requires ARC support." | |
11 #endif | |
12 | |
13 @implementation TitleLabel { | 9 @implementation TitleLabel { |
14 __weak id _accessibilityTarget; | 10 id _accessibilityTarget; // weak |
15 SEL _accessibilityAction; | 11 SEL _accessibilityAction; |
16 } | 12 } |
17 | 13 |
18 - (void)addAccessibilityElementFocusedTarget:(id)accessibilityTarget | 14 - (void)addAccessibilityElementFocusedTarget:(id)accessibilityTarget |
19 action:(SEL)accessibilityAction { | 15 action:(SEL)accessibilityAction { |
20 DCHECK(!accessibilityTarget || | 16 DCHECK(!accessibilityTarget || |
21 [accessibilityTarget respondsToSelector:accessibilityAction]); | 17 [accessibilityTarget respondsToSelector:accessibilityAction]); |
22 _accessibilityTarget = accessibilityTarget; | 18 _accessibilityTarget = accessibilityTarget; |
23 _accessibilityAction = accessibilityAction; | 19 _accessibilityAction = accessibilityAction; |
24 } | 20 } |
25 | 21 |
26 - (void)accessibilityElementDidBecomeFocused { | 22 - (void)accessibilityElementDidBecomeFocused { |
27 #pragma clang diagnostic push | |
28 #pragma clang diagnostic ignored "-Warc-performSelector-leaks" | |
29 [_accessibilityTarget performSelector:_accessibilityAction withObject:self]; | 23 [_accessibilityTarget performSelector:_accessibilityAction withObject:self]; |
30 #pragma clang diagnostic pop | |
31 } | 24 } |
32 | 25 |
33 @end | 26 @end |
OLD | NEW |