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

Side by Side Diff: chrome/browser/ui/android/context_menu_helper.h

Issue 2804913003: Remove redundant code from Android context menu native. (Closed)
Patch Set: Address dtrainor@ comments Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_
6 #define CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ 6 #define CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/android/jni_android.h" 12 #include "base/android/jni_android.h"
13 #include "base/callback.h" 13 #include "base/android/scoped_java_ref.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "chrome/common/thumbnail_capturer.mojom.h"
16 #include "content/public/browser/web_contents_user_data.h" 15 #include "content/public/browser/web_contents_user_data.h"
17 #include "content/public/common/context_menu_params.h" 16 #include "content/public/common/context_menu_params.h"
18 #include "ui/gfx/geometry/size.h"
19 17
20 namespace content { 18 namespace content {
21 struct ContextMenuParams; 19 struct ContextMenuParams;
22 class RenderFrameHost; 20 class RenderFrameHost;
23 class WebContents; 21 class WebContents;
24 } 22 }
25 23
26 class ContextMenuHelper 24 class ContextMenuHelper
27 : public content::WebContentsUserData<ContextMenuHelper> { 25 : public content::WebContentsUserData<ContextMenuHelper> {
28 public: 26 public:
29 ~ContextMenuHelper() override; 27 ~ContextMenuHelper() override;
30 28
31 void ShowContextMenu(content::RenderFrameHost* render_frame_host, 29 void ShowContextMenu(content::RenderFrameHost* render_frame_host,
32 const content::ContextMenuParams& params); 30 const content::ContextMenuParams& params);
33 31
34 void OnContextMenuClosed(JNIEnv* env, 32 void OnContextMenuClosed(JNIEnv* env,
35 const base::android::JavaParamRef<jobject>& obj); 33 const base::android::JavaParamRef<jobject>& obj);
36 34
37 void SetPopulator(jobject jpopulator); 35 void SetPopulator(jobject jpopulator);
38 36
39 // Methods called from Java via JNI ------------------------------------------ 37 // Methods called from Java via JNI ------------------------------------------
38 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents(
39 JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj);
40 void OnStartDownload(JNIEnv* env, 41 void OnStartDownload(JNIEnv* env,
41 const base::android::JavaParamRef<jobject>& obj, 42 const base::android::JavaParamRef<jobject>& obj,
42 jboolean jis_link, 43 jboolean jis_link,
43 jboolean jis_data_reduction_proxy_enabled); 44 jboolean jis_data_reduction_proxy_enabled);
45 void RetrieveImage(JNIEnv* env,
46 const base::android::JavaParamRef<jobject>& obj,
47 const base::android::JavaParamRef<jobject>& jcallback,
48 jint max_dimen_px);
44 void SearchForImage(JNIEnv* env, 49 void SearchForImage(JNIEnv* env,
45 const base::android::JavaParamRef<jobject>& obj); 50 const base::android::JavaParamRef<jobject>& obj);
46 void ShareImage(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
47
48 void RetrieveHeaderThumbnail(JNIEnv* env,
49 const base::android::JavaParamRef<jobject>& obj,
50 jint j_max_size_px);
51 51
52 private: 52 private:
53 explicit ContextMenuHelper(content::WebContents* web_contents); 53 explicit ContextMenuHelper(content::WebContents* web_contents);
54 friend class content::WebContentsUserData<ContextMenuHelper>; 54 friend class content::WebContentsUserData<ContextMenuHelper>;
55 55
56 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams( 56 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams(
57 const content::ContextMenuParams& params); 57 const content::ContextMenuParams& params);
58 58
59 void OnShareImage(chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer,
60 const std::vector<uint8_t>& thumbnail_data,
61 const gfx::Size& original_size);
62
63 void OnHeaderThumbnailReceived(
64 chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer,
65 const std::vector<uint8_t>& thumbnail_data,
66 const gfx::Size& original_size);
67
68 base::android::ScopedJavaGlobalRef<jobject> java_obj_; 59 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
69 content::WebContents* web_contents_; 60 content::WebContents* web_contents_;
70 61
71 content::ContextMenuParams context_menu_params_; 62 content::ContextMenuParams context_menu_params_;
72 int render_frame_id_; 63 int render_frame_id_;
73 int render_process_id_; 64 int render_process_id_;
74 65
75 base::WeakPtrFactory<ContextMenuHelper> weak_factory_;
76
77 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper); 66 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper);
78 }; 67 };
79 68
80 bool RegisterContextMenuHelper(JNIEnv* env); 69 bool RegisterContextMenuHelper(JNIEnv* env);
81 70
82 #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ 71 #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698