Chromium Code Reviews| Index: ios/chrome/browser/ui/reading_list/offline_page_native_content.mm |
| diff --git a/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm b/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm |
| index 1d2442330ffb93563eaaabc70ca2a397907ecca0..1fff9fb503097dd3d42ca81176d50561dabf6d9e 100644 |
| --- a/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm |
| +++ b/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm |
| @@ -13,17 +13,20 @@ |
| #include "ios/chrome/browser/reading_list/reading_list_download_service.h" |
| #include "ios/chrome/browser/reading_list/reading_list_download_service_factory.h" |
| #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
| +#import "ios/chrome/browser/ui/context_menu/context_menu_delegate.h" |
| #import "ios/chrome/browser/ui/static_content/static_html_view_controller.h" |
| #include "ios/web/public/browser_state.h" |
| #import "ios/web/public/navigation_item.h" |
| #import "ios/web/public/navigation_manager.h" |
| +#import "ios/web/public/web_state/context_menu_params.h" |
| +#import "ios/web/public/web_state/ui/crw_context_menu_controller.h" |
| #import "ios/web/public/web_state/web_state.h" |
| #if !defined(__has_feature) || !__has_feature(objc_arc) |
| #error "This file requires ARC support." |
| #endif |
| -@interface OfflinePageNativeContent () |
| +@interface OfflinePageNativeContent ()<CRWContextMenuControllerDelegate> |
| // Restores the last committed item to its initial state. |
| - (void)restoreOnlineURL; |
| @end |
| @@ -37,12 +40,15 @@ |
| // The WebState of the current tab. |
| web::WebState* _webState; |
| + |
| + id<ContextMenuDelegate> _contextMenuDelegate; |
| } |
| - (instancetype)initWithLoader:(id<UrlLoader>)loader |
| browserState:(web::BrowserState*)browserState |
| webState:(web::WebState*)webState |
| - URL:(const GURL&)URL { |
| + URL:(const GURL&)URL |
| + contextMenuDelegate:(id<ContextMenuDelegate>)contextMenuDelegate { |
| DCHECK(loader); |
| DCHECK(browserState); |
| DCHECK(URL.is_valid()); |
| @@ -56,6 +62,7 @@ |
| ->OfflineRoot(); |
| _webState = webState; |
| + _contextMenuDelegate = contextMenuDelegate; |
| GURL resourcesRoot; |
| GURL fileURL = |
| reading_list::FileURLForDistilledURL(URL, offline_root, &resourcesRoot); |
| @@ -63,7 +70,9 @@ |
| StaticHtmlViewController* HTMLViewController = |
| [[StaticHtmlViewController alloc] initWithFileURL:fileURL |
| allowingReadAccessToURL:resourcesRoot |
| - browserState:browserState]; |
| + browserState:browserState |
| + contextMenuDelegate:self]; |
| + |
| _virtualURL = reading_list::VirtualURLForDistilledURL(URL); |
| return [super initWithLoader:loader |
| @@ -97,4 +106,8 @@ |
| item->SetVirtualURL([self virtualURL]); |
| } |
|
jif
2017/01/12 17:13:12
#pragma mark - CRWContextMenuControllerDelegate ?
Olivier
2017/01/13 10:20:25
Done (in staticHTMLViewController)
|
| +- (BOOL)handleContextMenu:(const web::ContextMenuParams&)params { |
| + return [_contextMenuDelegate webState:_webState handleContextMenu:params]; |
| +} |
| + |
| @end |