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

Unified Diff: ios/web/public/web_state/ui/crw_context_menu_delegate.h

Issue 2627093003: Reuse context menu in StaticHTMLViewController (Closed)
Patch Set: feedback 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/web/public/web_state/ui/crw_context_menu_delegate.h
diff --git a/ios/web/public/web_state/ui/crw_context_menu_delegate.h b/ios/web/public/web_state/ui/crw_context_menu_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..e635acfbe39072018b3d948e47bfe18f36ebea53
--- /dev/null
+++ b/ios/web/public/web_state/ui/crw_context_menu_delegate.h
@@ -0,0 +1,27 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTEXT_MENU_DELEGATE_H_
+#define IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTEXT_MENU_DELEGATE_H_
+
+#import <WebKit/WebKit.h>
+
+#import "ios/web/public/web_state/context_menu_params.h"
+
+// Implement this protocol to listen to the custom context menu trigger from
+// WKWebView.
+@protocol CRWContextMenuDelegate
+// Called when the custom Context menu recognizer triggers on |webView|.
+// - triggered on a long press gesture, slightly shorter than the default
+// context menu recognizer.
+// - if result is YES, the system context meny will be suppressed.
+// YES must be returned within 0.05 second.
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 Is it a requirement to return YES in 0.05 seconds?
Olivier 2017/01/13 18:49:55 At least if you spin the runloop, it will be a pro
Eugene But (OOO till 7-30) 2017/01/13 19:00:32 Thanks! So should this comment be "YES must be ret
Olivier 2017/01/16 08:31:05 Done.
+// - if result is NO, the system context meny will be displayed.
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 s/meny/menu
Olivier 2017/01/13 18:49:55 Done.
+// - Client can return YES without showing any UI to cancel the system context
+// menu.
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 Please also document that method is not called if
Olivier 2017/01/13 18:49:55 Done.
+- (BOOL)webView:(WKWebView*)webView
+ handleContextMenu:(const web::ContextMenuParams&)params;
+@end
+
+#endif // IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTEXT_MENU_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698