Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: ios/chrome/browser/ui/reading_list/offline_page_native_content.mm

Issue 2627093003: Reuse context menu in StaticHTMLViewController (Closed)
Patch Set: fix DEPS Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698