| OLD | NEW |
| 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 | 10 |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/common/thumbnail_capturer.mojom.h" |
| 14 #include "content/public/browser/web_contents_user_data.h" | 15 #include "content/public/browser/web_contents_user_data.h" |
| 15 #include "content/public/common/context_menu_params.h" | 16 #include "content/public/common/context_menu_params.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 struct ContextMenuParams; | 20 struct ContextMenuParams; |
| 20 class RenderFrameHost; | 21 class RenderFrameHost; |
| 21 class WebContents; | 22 class WebContents; |
| 22 } | 23 } |
| 23 | 24 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 const base::android::JavaParamRef<jobject>& obj); | 44 const base::android::JavaParamRef<jobject>& obj); |
| 44 void ShareImage(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 45 void ShareImage(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 explicit ContextMenuHelper(content::WebContents* web_contents); | 48 explicit ContextMenuHelper(content::WebContents* web_contents); |
| 48 friend class content::WebContentsUserData<ContextMenuHelper>; | 49 friend class content::WebContentsUserData<ContextMenuHelper>; |
| 49 | 50 |
| 50 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams( | 51 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams( |
| 51 const content::ContextMenuParams& params); | 52 const content::ContextMenuParams& params); |
| 52 | 53 |
| 53 void OnShareImage(const std::string& thumbnail_data, | 54 void OnShareImage(chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer, |
| 55 const std::string& thumbnail_data, |
| 54 const gfx::Size& original_size); | 56 const gfx::Size& original_size); |
| 55 | 57 |
| 56 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 58 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 57 content::WebContents* web_contents_; | 59 content::WebContents* web_contents_; |
| 58 | 60 |
| 59 content::ContextMenuParams context_menu_params_; | 61 content::ContextMenuParams context_menu_params_; |
| 60 int render_frame_id_; | 62 int render_frame_id_; |
| 61 int render_process_id_; | 63 int render_process_id_; |
| 62 | 64 |
| 65 base::WeakPtrFactory<ContextMenuHelper> weak_factory_; |
| 66 |
| 63 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper); | 67 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper); |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 bool RegisterContextMenuHelper(JNIEnv* env); | 70 bool RegisterContextMenuHelper(JNIEnv* env); |
| 67 | 71 |
| 68 #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ | 72 #endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_ |
| OLD | NEW |