| 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 4576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4587 // | 4587 // |
| 4588 // To override the context menu, this recognizer needs to react faster than | 4588 // To override the context menu, this recognizer needs to react faster than |
| 4589 // the 0.75s one. The below gesture recognizer is initialized with a | 4589 // the 0.75s one. The below gesture recognizer is initialized with a |
| 4590 // detection duration a little lower than that (see | 4590 // detection duration a little lower than that (see |
| 4591 // kLongPressDurationSeconds). It also points the delegate to this class | 4591 // kLongPressDurationSeconds). It also points the delegate to this class |
| 4592 // that | 4592 // that |
| 4593 // allows simultaneously operate along with the other recognizers. | 4593 // allows simultaneously operate along with the other recognizers. |
| 4594 _contextMenuRecognizer.reset([[UILongPressGestureRecognizer alloc] | 4594 _contextMenuRecognizer.reset([[UILongPressGestureRecognizer alloc] |
| 4595 initWithTarget:self | 4595 initWithTarget:self |
| 4596 action:@selector(showContextMenu:)]); | 4596 action:@selector(showContextMenu:)]); |
| 4597 [_contextMenuRecognizer | |
| 4598 requireGestureRecognizerToFail:self.webScrollView.panGestureRecognizer]; | |
| 4599 [_contextMenuRecognizer setMinimumPressDuration:kLongPressDurationSeconds]; | 4597 [_contextMenuRecognizer setMinimumPressDuration:kLongPressDurationSeconds]; |
| 4600 [_contextMenuRecognizer setAllowableMovement:kLongPressMoveDeltaPixels]; | 4598 [_contextMenuRecognizer setAllowableMovement:kLongPressMoveDeltaPixels]; |
| 4601 [_contextMenuRecognizer setDelegate:self]; | 4599 [_contextMenuRecognizer setDelegate:self]; |
| 4602 [_webView addGestureRecognizer:_contextMenuRecognizer]; | 4600 [_webView addGestureRecognizer:_contextMenuRecognizer]; |
| 4603 // Certain system gesture handlers are known to conflict with our context | 4601 // Certain system gesture handlers are known to conflict with our context |
| 4604 // menu handler, causing extra events to fire when the context menu is | 4602 // menu handler, causing extra events to fire when the context menu is |
| 4605 // active. | 4603 // active. |
| 4606 | 4604 |
| 4607 // A number of solutions have been investigated. The lowest-risk solution | 4605 // A number of solutions have been investigated. The lowest-risk solution |
| 4608 // appears to be to recurse through the web controller's recognizers, | 4606 // appears to be to recurse through the web controller's recognizers, |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5650 } | 5648 } |
| 5651 | 5649 |
| 5652 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5650 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5653 } | 5651 } |
| 5654 | 5652 |
| 5655 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5653 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5656 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5654 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5657 } | 5655 } |
| 5658 | 5656 |
| 5659 @end | 5657 @end |
| OLD | NEW |