| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2012 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/web/web_state/ui/crw_touch_tracking_recognizer.h" |
| 6 |
| 7 @interface CRWTouchTrackingRecognizer () <UIGestureRecognizerDelegate> { |
| 8 __weak id<CRWTouchTrackingDelegate> _delegate; |
| 9 } |
| 10 @end |
| 11 |
| 12 @implementation CRWTouchTrackingRecognizer |
| 13 |
| 14 @synthesize touchTrackingDelegate = _delegate; |
| 15 |
| 16 - (id)initWithDelegate:(id<CRWTouchTrackingDelegate>)delegate { |
| 17 if ((self = [super init])) { |
| 18 _delegate = delegate; |
| 19 self.delegate = self; |
| 20 } |
| 21 return self; |
| 22 } |
| 23 |
| 24 #pragma mark - |
| 25 #pragma mark UIGestureRecognizer Methods |
| 26 |
| 27 - (void)reset { |
| 28 [super reset]; |
| 29 } |
| 30 |
| 31 - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { |
| 32 [super touchesBegan:touches withEvent:event]; |
| 33 [_delegate touched:YES]; |
| 34 } |
| 35 |
| 36 - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { |
| 37 [super touchesMoved:touches withEvent:event]; |
| 38 } |
| 39 |
| 40 - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { |
| 41 [super touchesEnded:touches withEvent:event]; |
| 42 self.state = UIGestureRecognizerStateFailed; |
| 43 [_delegate touched:NO]; |
| 44 } |
| 45 |
| 46 - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { |
| 47 [super touchesCancelled:touches withEvent:event]; |
| 48 [_delegate touched:NO]; |
| 49 } |
| 50 |
| 51 #pragma mark - |
| 52 #pragma mark UIGestureRecognizerDelegate Method |
| 53 |
| 54 - (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer |
| 55 shouldRecognizeSimultaneouslyWithGestureRecognizer: |
| 56 (UIGestureRecognizer*)otherGestureRecognizer { |
| 57 return YES; |
| 58 } |
| 59 |
| 60 @end |
| OLD | NEW |