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