[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 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 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: | ||||
dcheng | 361fdb3 | 2015-02-04 02:56:07 | [diff] [blame] | 24 | ~ContextMenuHelper() override; |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 25 | |
amaralp | dbb23e2 | 2016-09-26 22:40:11 | [diff] [blame] | 26 | void ShowContextMenu(content::RenderFrameHost* render_frame_host, |
tedchoc | cd0bf1f | 2015-12-15 21:23:10 | [diff] [blame] | 27 | const content::ContextMenuParams& params); |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 28 | |
shaktisahu | 3a2f73d | 2016-12-06 04:34:31 | [diff] [blame] | 29 | void OnContextMenuClosed(JNIEnv* env, |
30 | const base::android::JavaParamRef<jobject>& obj); | ||||
31 | |||||
Sinan Sahin | 57341761 | 2020-09-25 19:21:50 | [diff] [blame] | 32 | void SetPopulatorFactory( |
33 | const base::android::JavaRef<jobject>& jpopulator_factory); | ||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 34 | |
Gang Wu | 6599f0ba | 2020-04-02 05:57:23 | [diff] [blame] | 35 | private: |
36 | explicit ContextMenuHelper(content::WebContents* web_contents); | ||||
37 | friend class content::WebContentsUserData<ContextMenuHelper>; | ||||
38 | |||||
Gang Wu | 6599f0ba | 2020-04-02 05:57:23 | [diff] [blame] | 39 | mojo::AssociatedRemote<chrome::mojom::ChromeRenderFrame> |
40 | GetChromeRenderFrame() const; | ||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 41 | |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 42 | base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
43 | content::WebContents* web_contents_; | ||||
44 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 45 | content::ContextMenuParams context_menu_params_; |
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 46 | |
François Doray | 4f51d5d | 2018-12-03 22:26:24 | [diff] [blame] | 47 | WEB_CONTENTS_USER_DATA_KEY_DECL(); |
48 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 49 | DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper); |
50 | }; | ||||
51 | |||||
[email protected] | e9622687 | 2013-12-06 00:02:37 | [diff] [blame] | 52 | #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ |