| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 // Set the specified recognizer to take priority over any recognizers in the | 1607 // Set the specified recognizer to take priority over any recognizers in the |
| 1608 // view that have a description containing the specified text fragment. | 1608 // view that have a description containing the specified text fragment. |
| 1609 + (void)requireGestureRecognizerToFail:(UIGestureRecognizer*)recognizer | 1609 + (void)requireGestureRecognizerToFail:(UIGestureRecognizer*)recognizer |
| 1610 inView:(UIView*)view | 1610 inView:(UIView*)view |
| 1611 containingDescription:(NSString*)fragment { | 1611 containingDescription:(NSString*)fragment { |
| 1612 for (UIGestureRecognizer* iRecognizer in [view gestureRecognizers]) { | 1612 for (UIGestureRecognizer* iRecognizer in [view gestureRecognizers]) { |
| 1613 if (iRecognizer != recognizer) { | 1613 if (iRecognizer != recognizer) { |
| 1614 NSString* description = [iRecognizer description]; | 1614 NSString* description = [iRecognizer description]; |
| 1615 if ([description rangeOfString:fragment].location != NSNotFound) { | 1615 if ([description rangeOfString:fragment].length) { |
| 1616 [iRecognizer requireGestureRecognizerToFail:recognizer]; | 1616 [iRecognizer requireGestureRecognizerToFail:recognizer]; |
| 1617 // requireGestureRecognizerToFail: doesn't retain the recognizer, so it | 1617 // requireGestureRecognizerToFail: doesn't retain the recognizer, so it |
| 1618 // is possible for |iRecognizer| to outlive |recognizer| and end up with | 1618 // is possible for |iRecognizer| to outlive |recognizer| and end up with |
| 1619 // a dangling pointer. Add a retaining associative reference to ensure | 1619 // a dangling pointer. Add a retaining associative reference to ensure |
| 1620 // that the lifetimes work out. | 1620 // that the lifetimes work out. |
| 1621 // Note that normally using the value as the key wouldn't make any | 1621 // Note that normally using the value as the key wouldn't make any |
| 1622 // sense, but here it's fine since nothing needs to look up the value. | 1622 // sense, but here it's fine since nothing needs to look up the value. |
| 1623 objc_setAssociatedObject(view, recognizer, recognizer, | 1623 objc_setAssociatedObject(view, recognizer, recognizer, |
| 1624 OBJC_ASSOCIATION_RETAIN_NONATOMIC); | 1624 OBJC_ASSOCIATION_RETAIN_NONATOMIC); |
| 1625 } | 1625 } |
| (...skipping 4039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5665 } | 5665 } |
| 5666 | 5666 |
| 5667 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5667 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5668 } | 5668 } |
| 5669 | 5669 |
| 5670 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5670 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5671 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5671 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5672 } | 5672 } |
| 5673 | 5673 |
| 5674 @end | 5674 @end |
| OLD | NEW |