[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ | ||||
6 | #define CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ | ||||
7 | |||||
dcheng | 9603ab9 | 2016-04-08 04:17:32 | [diff] [blame] | 8 | #include <memory> |
tedchoc | 23990ba | 2015-10-29 18:48:48 | [diff] [blame] | 9 | #include <string> |
watk | 2c47200 | 2017-03-14 05:52:28 | [diff] [blame] | 10 | #include <vector> |
tedchoc | 23990ba | 2015-10-29 18:48:48 | [diff] [blame] | 11 | |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 12 | #include "base/android/jni_android.h" |
tedchoc | 69a502c | 2017-04-07 18:11:36 | [diff] [blame] | 13 | #include "base/android/scoped_java_ref.h" |
avi | 655876a | 2015-12-25 07:18:15 | [diff] [blame] | 14 | #include "base/macros.h" |
Nicholas Verne | c6b829a | 2017-10-24 13:43:56 | [diff] [blame] | 15 | #include "chrome/common/chrome_render_frame.mojom.h" |
Josh Simmons | 6067fdb | 2020-01-17 08:56:50 | [diff] [blame] | 16 | #include "components/optimization_guide/proto/performance_hints_metadata.pb.h" |
Lukasz Anforowicz | 8c4446dc | 2020-03-11 22:16:42 | [diff] [blame] | 17 | #include "content/public/browser/context_menu_params.h" |
Jinsuk Kim | 6d4d86e | 2020-05-14 12:10:15 | [diff] [blame^] | 18 | #include "content/public/browser/render_frame_host.h" |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 19 | #include "content/public/browser/web_contents_user_data.h" |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 20 | |
21 | namespace content { | ||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 22 | class WebContents; |
23 | } | ||||
24 | |||||
25 | class ContextMenuHelper | ||||
26 | : public content::WebContentsUserData<ContextMenuHelper> { | ||||
27 | public: | ||||
dcheng | 361fdb3 | 2015-02-04 02:56:07 | [diff] [blame] | 28 | ~ContextMenuHelper() override; |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 29 | |
amaralp | dbb23e2 | 2016-09-26 22:40:11 | [diff] [blame] | 30 | void ShowContextMenu(content::RenderFrameHost* render_frame_host, |
tedchoc | cd0bf1f | 2015-12-15 21:23:10 | [diff] [blame] | 31 | const content::ContextMenuParams& params); |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 32 | |
shaktisahu | 3a2f73d | 2016-12-06 04:34:31 | [diff] [blame] | 33 | void OnContextMenuClosed(JNIEnv* env, |
34 | const base::android::JavaParamRef<jobject>& obj); | ||||
35 | |||||
Torne (Richard Coles) | 0a10875 | 2017-07-25 15:08:41 | [diff] [blame] | 36 | void SetPopulator(const base::android::JavaRef<jobject>& jpopulator); |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 37 | |
Gang Wu | 6599f0ba | 2020-04-02 05:57:23 | [diff] [blame] | 38 | private: |
39 | explicit ContextMenuHelper(content::WebContents* web_contents); | ||||
40 | friend class content::WebContentsUserData<ContextMenuHelper>; | ||||
41 | |||||
Gang Wu | 6599f0ba | 2020-04-02 05:57:23 | [diff] [blame] | 42 | mojo::AssociatedRemote<chrome::mojom::ChromeRenderFrame> |
43 | GetChromeRenderFrame() const; | ||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 44 | |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 45 | base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
46 | content::WebContents* web_contents_; | ||||
47 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 48 | content::ContextMenuParams context_menu_params_; |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 49 | |
François Doray | 4f51d5d | 2018-12-03 22:26:24 | [diff] [blame] | 50 | WEB_CONTENTS_USER_DATA_KEY_DECL(); |
51 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 52 | DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper); |
53 | }; | ||||
54 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 55 | #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ |