[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 | |||||
8 | #include "base/android/jni_android.h" | ||||
tedchoc | 69a502c | 2017-04-07 18:11:36 | [diff] [blame] | 9 | #include "base/android/scoped_java_ref.h" |
avi | 655876a | 2015-12-25 07:18:15 | [diff] [blame] | 10 | #include "base/macros.h" |
Nicholas Verne | c6b829a | 2017-10-24 13:43:56 | [diff] [blame] | 11 | #include "chrome/common/chrome_render_frame.mojom.h" |
Josh Simmons | 6067fdb | 2020-01-17 08:56:50 | [diff] [blame] | 12 | #include "components/optimization_guide/proto/performance_hints_metadata.pb.h" |
Lukasz Anforowicz | 8c4446dc | 2020-03-11 22:16:42 | [diff] [blame] | 13 | #include "content/public/browser/context_menu_params.h" |
Jinsuk Kim | 6d4d86e | 2020-05-14 12:10:15 | [diff] [blame] | 14 | #include "content/public/browser/render_frame_host.h" |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 15 | #include "content/public/browser/web_contents_user_data.h" |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 16 | |
17 | namespace content { | ||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 18 | class WebContents; |
19 | } | ||||
20 | |||||
21 | class ContextMenuHelper | ||||
22 | : public content::WebContentsUserData<ContextMenuHelper> { | ||||
23 | public: | ||||
Peter Boström | 53c6c595 | 2021-09-17 09:41:26 | [diff] [blame^] | 24 | ContextMenuHelper(const ContextMenuHelper&) = delete; |
25 | ContextMenuHelper& operator=(const ContextMenuHelper&) = delete; | ||||
26 | |||||
dcheng | 361fdb3 | 2015-02-04 02:56:07 | [diff] [blame] | 27 | ~ContextMenuHelper() override; |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 28 | |
amaralp | dbb23e2 | 2016-09-26 22:40:11 | [diff] [blame] | 29 | void ShowContextMenu(content::RenderFrameHost* render_frame_host, |
tedchoc | cd0bf1f | 2015-12-15 21:23:10 | [diff] [blame] | 30 | const content::ContextMenuParams& params); |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 31 | |
shaktisahu | 3a2f73d | 2016-12-06 04:34:31 | [diff] [blame] | 32 | void OnContextMenuClosed(JNIEnv* env, |
33 | const base::android::JavaParamRef<jobject>& obj); | ||||
34 | |||||
Sinan Sahin | 57341761 | 2020-09-25 19:21:50 | [diff] [blame] | 35 | void SetPopulatorFactory( |
36 | const base::android::JavaRef<jobject>& jpopulator_factory); | ||||
[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(); |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 51 | }; |
52 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 53 | #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ |