Chromium Code Reviews| Index: ios/web_view/internal/cwv_web_view.mm |
| diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm |
| index 648cbfac4bbbb7392c8e367f9ef817c752444b88..7fae1af3709731157acd9fb478854416cebc2639 100644 |
| --- a/ios/web_view/internal/cwv_web_view.mm |
| +++ b/ios/web_view/internal/cwv_web_view.mm |
| @@ -12,6 +12,7 @@ |
| #include "base/strings/sys_string_conversions.h" |
| #import "ios/web/public/navigation_manager.h" |
| #include "ios/web/public/referrer.h" |
| +#import "ios/web/public/web_state/context_menu_params.h" |
| #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
| #import "ios/web/public/web_state/ui/crw_web_delegate.h" |
| #import "ios/web/public/web_state/web_state.h" |
| @@ -20,6 +21,8 @@ |
| #import "ios/web_view/internal/cwv_website_data_store_internal.h" |
| #import "ios/web_view/internal/translate/web_view_translate_client.h" |
| #include "ios/web_view/internal/web_view_browser_state.h" |
| +#import "ios/web_view/public/cwv_html_element.h" |
| +#import "ios/web_view/public/cwv_ui_delegate.h" |
| #import "ios/web_view/public/cwv_web_view_configuration.h" |
| #import "ios/web_view/public/cwv_web_view_delegate.h" |
| #import "ios/web_view/public/cwv_website_data_store.h" |
| @@ -45,6 +48,7 @@ |
| @synthesize delegate = _delegate; |
| @synthesize loadProgress = _loadProgress; |
| +@synthesize UIDelegate = _UIDelegate; |
| - (instancetype)initWithFrame:(CGRect)frame |
| configuration:(CWVWebViewConfiguration*)configuration { |
| @@ -185,4 +189,25 @@ |
| [self notifyDidUpdateWithChanges:CRIWVWebViewUpdateTypeProgress]; |
| } |
| +- (BOOL)webState:(web::WebState*)webState |
| + handleContextMenu:(const web::ContextMenuParams&)params { |
| + if ([_UIDelegate respondsToSelector:@selector |
|
Eugene But (OOO till 7-30)
2017/02/27 16:34:06
Optional nit: do you want to reverse the condition
michaeldo
2017/02/27 19:02:05
I agree, I like that better.
|
| + (webView:runContextMenuWithTitle:forHTMLElement:inView |
|
Eugene But (OOO till 7-30)
2017/02/27 16:34:06
Optional nit: Do you want to create a local variab
michaeldo
2017/02/27 19:02:05
Done.
|
| + :userGestureLocation:)]) { |
| + NSURL* hyperlink = net::NSURLWithGURL(params.link_url); |
| + NSURL* mediaSource = net::NSURLWithGURL(params.src_url); |
| + CWVHTMLElement* htmlElement = |
|
Eugene But (OOO till 7-30)
2017/02/27 16:34:06
s/htmlElement/HTMLElement
michaeldo
2017/02/27 19:02:06
Done.
|
| + [[CWVHTMLElement alloc] initWithHyperlink:hyperlink |
| + mediaSource:mediaSource |
| + text:params.link_text]; |
| + [_UIDelegate webView:self |
| + runContextMenuWithTitle:params.menu_title |
| + forHTMLElement:htmlElement |
| + inView:params.view |
| + userGestureLocation:params.location]; |
| + return YES; |
| + } |
| + return NO; |
| +} |
| + |
| @end |