Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: ios/web/web_state/ui/crw_touch_tracking_recognizer.mm

Issue 1048613002: Upstream ios/web/web_state/ui support classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang format Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/ui/crw_touch_tracking_recognizer.mm
diff --git a/ios/web/web_state/ui/crw_touch_tracking_recognizer.mm b/ios/web/web_state/ui/crw_touch_tracking_recognizer.mm
new file mode 100644
index 0000000000000000000000000000000000000000..48032530eb8e0921325d1a3e3f1db2b91a27aeca
--- /dev/null
+++ b/ios/web/web_state/ui/crw_touch_tracking_recognizer.mm
@@ -0,0 +1,60 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/web/web_state/ui/crw_touch_tracking_recognizer.h"
+
+@interface CRWTouchTrackingRecognizer () <UIGestureRecognizerDelegate> {
+ __weak id<CRWTouchTrackingDelegate> _delegate;
+}
+@end
+
+@implementation CRWTouchTrackingRecognizer
+
+@synthesize touchTrackingDelegate = _delegate;
+
+- (id)initWithDelegate:(id<CRWTouchTrackingDelegate>)delegate {
+ if ((self = [super init])) {
+ _delegate = delegate;
+ self.delegate = self;
+ }
+ return self;
+}
+
+#pragma mark -
+#pragma mark UIGestureRecognizer Methods
+
+- (void)reset {
+ [super reset];
+}
+
+- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
+ [super touchesBegan:touches withEvent:event];
+ [_delegate touched:YES];
+}
+
+- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
+ [super touchesMoved:touches withEvent:event];
+}
+
+- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
+ [super touchesEnded:touches withEvent:event];
+ self.state = UIGestureRecognizerStateFailed;
+ [_delegate touched:NO];
+}
+
+- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event {
+ [super touchesCancelled:touches withEvent:event];
+ [_delegate touched:NO];
+}
+
+#pragma mark -
+#pragma mark UIGestureRecognizerDelegate Method
+
+- (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer
+ shouldRecognizeSimultaneouslyWithGestureRecognizer:
+ (UIGestureRecognizer*)otherGestureRecognizer {
+ return YES;
+}
+
+@end
« no previous file with comments | « ios/web/web_state/ui/crw_touch_tracking_recognizer.h ('k') | ios/web/web_state/ui/crw_ui_simple_web_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698