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

Unified Diff: ios/chrome/browser/ui/contextual_search/window_gesture_observer.h

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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/chrome/browser/ui/contextual_search/window_gesture_observer.h
diff --git a/ios/chrome/browser/ui/contextual_search/window_gesture_observer.h b/ios/chrome/browser/ui/contextual_search/window_gesture_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..0bd2b1b60a00206d7370a320a03c338dc6435d84
--- /dev/null
+++ b/ios/chrome/browser/ui/contextual_search/window_gesture_observer.h
@@ -0,0 +1,40 @@
+// Copyright 2014 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.
+
+#ifndef IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_WINDOW_GESTURE_OBSERVER_H_
+#define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_WINDOW_GESTURE_OBSERVER_H_
+
+#import <UIKit/UIGestureRecognizerSubclass.h>
+#import <UIKit/UIKit.h>
+
+// A specialized gesture recognizer to be used to detect any gesture in the app,
+// excluding those whose touches are solely on a particular view.
+// A WindowGestureObserver should be added to the app's main window.
+// Use the normal -initWithTarget:action: method to create instances of this
+// class.
+// This recognizer *never* succeeds and doesn't use the target and action in
+// the normal way. Instead, as soon as there is a touch event that is not
+// inside |viewToExclude|, this recognizer will call the given action method on
+// the target. Then this recognizer will immediately fail and pass the touches
+// on to other recognizers.
+// Before the action method is called, |touchedView| will be populated with
+// a pointer to the view that triggered the call.
+// In case there are multiple touches that simultaneously trigger this
+// recognizer, only the first touch that is outside of |viewToExclude| will
+// trigger a call to the action method. There is no guarantee about how "first"
+// will be determined in this case.
+// The target and action supplied in the -init will never be called in the
+// usual way other regognizers call their action methods, and adding new
+// target/action pairs will silently no-op.
+// If |viewToExclude| is defined, this recognizer will require all gesture
+// recognizers on it present at initialization time to fail before receiving
+// touch events.
+
+@interface WindowGestureObserver : UIGestureRecognizer
+
+@property(nonatomic, assign) UIView* viewToExclude;
+@property(nonatomic, readonly) UIView* touchedView;
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_WINDOW_GESTURE_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698