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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 // Mark the destruction sequence has started, in case someone else holds a | 1291 // Mark the destruction sequence has started, in case someone else holds a |
1292 // strong reference and tries to continue using the tab. | 1292 // strong reference and tries to continue using the tab. |
1293 _isBeingDestroyed = YES; | 1293 _isBeingDestroyed = YES; |
1294 | 1294 |
1295 // Remove the web view now. Otherwise, delegate callbacks occur. | 1295 // Remove the web view now. Otherwise, delegate callbacks occur. |
1296 [self removeWebViewAllowingCachedReconstruction:NO]; | 1296 [self removeWebViewAllowingCachedReconstruction:NO]; |
1297 | 1297 |
1298 _webStateImpl = nullptr; | 1298 _webStateImpl = nullptr; |
1299 } | 1299 } |
1300 | 1300 |
1301 - (void)checkLinkPresenceUnderGesture:(UIGestureRecognizer*)gestureRecognizer | |
1302 completionHandler:(void (^)(BOOL))completionHandler { | |
1303 CGPoint webViewPoint = [gestureRecognizer locationInView:_webView]; | |
1304 base::WeakNSObject<CRWWebController> weakSelf(self); | |
1305 [self fetchDOMElementAtPoint:webViewPoint | |
1306 completionHandler:^(NSDictionary* element) { | |
1307 BOOL hasLink = [element[@"href"] length]; | |
1308 completionHandler(hasLink); | |
1309 }]; | |
1310 } | |
1311 | |
1312 - (void)setDOMElementForLastTouch:(NSDictionary*)element { | 1301 - (void)setDOMElementForLastTouch:(NSDictionary*)element { |
1313 _DOMElementForLastTouch.reset([element copy]); | 1302 _DOMElementForLastTouch.reset([element copy]); |
1314 } | 1303 } |
1315 | 1304 |
1316 - (void)showContextMenu:(UIGestureRecognizer*)gestureRecognizer { | 1305 - (void)showContextMenu:(UIGestureRecognizer*)gestureRecognizer { |
1317 // We don't want ongoing notification that the long press is held. | 1306 // We don't want ongoing notification that the long press is held. |
1318 if ([gestureRecognizer state] != UIGestureRecognizerStateBegan) | 1307 if ([gestureRecognizer state] != UIGestureRecognizerStateBegan) |
1319 return; | 1308 return; |
1320 | 1309 |
1321 if (![_DOMElementForLastTouch count]) | 1310 if (![_DOMElementForLastTouch count]) |
(...skipping 4300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5622 } | 5611 } |
5623 | 5612 |
5624 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5613 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
5625 } | 5614 } |
5626 | 5615 |
5627 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5616 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
5628 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5617 return [action.request valueForHTTPHeaderField:@"Referer"]; |
5629 } | 5618 } |
5630 | 5619 |
5631 @end | 5620 @end |
OLD | NEW |