Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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" | |
| 9 #include "base/callback.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/public/browser/web_contents_user_data.h" | |
| 12 #include "content/public/common/context_menu_params.h" | |
| 13 | |
| 14 namespace content { | |
| 15 struct ContextMenuParams; | |
| 16 class WebContents; | |
| 17 } | |
| 18 | |
| 19 class ContextMenuHelper | |
| 20 : public content::WebContentsUserData<ContextMenuHelper> { | |
| 21 public: | |
| 22 virtual ~ContextMenuHelper(); | |
| 23 | |
| 24 void ShowContextMenu(const content::ContextMenuParams& params); | |
| 25 | |
| 26 void ShowCustomContextMenu( | |
| 27 const content::ContextMenuParams& params, | |
| 28 const base::Callback<void(int)>& callback); | |
| 29 | |
| 30 void SetPopulator(jobject jpopulator); | |
| 31 | |
| 32 const content::ContextMenuParams& GetCurrentContextMenuParams() const; | |
| 33 | |
| 34 // Methods called from Java via JNI ------------------------------------------ | |
| 35 | |
| 36 void OnCustomItemSelected(JNIEnv* env, jobject obj, jint action); | |
| 37 | |
| 38 private: | |
| 39 explicit ContextMenuHelper(content::WebContents* web_contents); | |
| 40 friend class content::WebContentsUserData<ContextMenuHelper>; | |
| 41 | |
| 42 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams( | |
| 43 const content::ContextMenuParams& params); | |
|
Ted C
2013/11/19 02:44:03
indented too much
David Trainor- moved to gerrit
2013/11/25 19:42:50
Done.
| |
| 44 | |
| 45 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
| 46 content::WebContents* web_contents_; | |
| 47 | |
| 48 base::Callback<void(int)> context_menu_callback_; | |
| 49 content::ContextMenuParams context_menu_params_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper); | |
| 52 }; | |
| 53 | |
| 54 bool RegisterContextMenuHelper(JNIEnv* env); | |
| 55 | |
| 56 #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ | |
| OLD | NEW |