Chromium Code Reviews| 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 #include "base/mac/scoped_nsobject.h" | |
|
justincohen
2017/04/05 14:22:07
sort?
| |
| 9 | |
| 10 @interface OverscrollActionsGestureRecognizer () { | |
| 11 base::scoped_nsprotocol<id> target_; | |
| 12 SEL action_; | |
| 13 } | |
| 14 @end | |
| 15 | |
| 16 @implementation OverscrollActionsGestureRecognizer | |
| 17 | |
| 18 - (instancetype)initWithTarget:(id)target action:(SEL)action { | |
| 19 self = [super initWithTarget:target action:action]; | |
| 20 if (self) { | |
| 21 target_.reset([target retain]); | |
| 22 action_ = action; | |
| 23 } | |
| 24 return self; | |
| 25 } | |
| 26 | |
| 27 - (void)reset { | |
| 28 [super reset]; | |
| 29 [target_ performSelector:action_ withObject:self]; | |
| 30 } | |
| 31 | |
| 32 - (void)removeTarget:(id)target action:(SEL)action { | |
|
justincohen
2017/04/05 14:22:07
This is all voodoo to me. Why is this necessary?
| |
| 33 [super removeTarget:target action:action]; | |
| 34 if (target == target_) { | |
| 35 target_.reset(); | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 @end | |
| OLD | NEW |