OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_gesture_rec
ognizer.h" |
| 6 |
| 7 #import <UIKit/UIGestureRecognizerSubclass.h> |
| 8 |
| 9 #import "base/ios/weak_nsobject.h" |
| 10 |
| 11 @interface OverscrollActionsGestureRecognizer () { |
| 12 base::WeakNSProtocol<id> target_; |
| 13 SEL action_; |
| 14 } |
| 15 @end |
| 16 |
| 17 @implementation OverscrollActionsGestureRecognizer |
| 18 |
| 19 - (instancetype)initWithTarget:(id)target action:(SEL)action { |
| 20 self = [super initWithTarget:target action:action]; |
| 21 if (self) { |
| 22 target_.reset([target retain]); |
| 23 action_ = action; |
| 24 } |
| 25 return self; |
| 26 } |
| 27 |
| 28 - (void)reset { |
| 29 [super reset]; |
| 30 [target_ performSelector:action_ withObject:self]; |
| 31 } |
| 32 |
| 33 - (void)removeTarget:(id)target action:(SEL)action { |
| 34 DCHECK(target != target_); |
| 35 [super removeTarget:target action:action]; |
| 36 } |
| 37 |
| 38 @end |
OLD | NEW |