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

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

Issue 1142863002: Remove support for custom menu items in context menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/browser/web_contents_user_data.h" 11 #include "content/public/browser/web_contents_user_data.h"
12 #include "content/public/common/context_menu_params.h" 12 #include "content/public/common/context_menu_params.h"
13 13
14 namespace content { 14 namespace content {
15 struct ContextMenuParams; 15 struct ContextMenuParams;
16 class WebContents; 16 class WebContents;
17 } 17 }
18 18
19 class ContextMenuHelper 19 class ContextMenuHelper
20 : public content::WebContentsUserData<ContextMenuHelper> { 20 : public content::WebContentsUserData<ContextMenuHelper> {
21 public: 21 public:
22 ~ContextMenuHelper() override; 22 ~ContextMenuHelper() override;
23 23
24 void ShowContextMenu(const content::ContextMenuParams& params); 24 void ShowContextMenu(const content::ContextMenuParams& params);
25 25
26 void ShowCustomContextMenu(
27 const content::ContextMenuParams& params,
28 const base::Callback<void(int)>& callback);
29
30 void SetPopulator(jobject jpopulator); 26 void SetPopulator(jobject jpopulator);
31 27
32 // Methods called from Java via JNI ------------------------------------------ 28 // Methods called from Java via JNI ------------------------------------------
33
34 void OnCustomItemSelected(JNIEnv* env, jobject obj, jint action);
35 void OnStartDownload(JNIEnv* env, jobject obj, jboolean jis_link); 29 void OnStartDownload(JNIEnv* env, jobject obj, jboolean jis_link);
36 30
37 private: 31 private:
38 explicit ContextMenuHelper(content::WebContents* web_contents); 32 explicit ContextMenuHelper(content::WebContents* web_contents);
39 friend class content::WebContentsUserData<ContextMenuHelper>; 33 friend class content::WebContentsUserData<ContextMenuHelper>;
40 34
41 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams( 35 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams(
42 const content::ContextMenuParams& params); 36 const content::ContextMenuParams& params);
43 37
44 base::android::ScopedJavaGlobalRef<jobject> java_obj_; 38 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
45 content::WebContents* web_contents_; 39 content::WebContents* web_contents_;
46 40
47 base::Callback<void(int)> context_menu_callback_;
48 content::ContextMenuParams context_menu_params_; 41 content::ContextMenuParams context_menu_params_;
49 42
50 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper); 43 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper);
51 }; 44 };
52 45
53 bool RegisterContextMenuHelper(JNIEnv* env); 46 bool RegisterContextMenuHelper(JNIEnv* env);
54 47
55 #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ 48 #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698