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