blob: 07ad50660ad28a8a4402b575305e0bafe6cdcc95 [file] [log] [blame]
[email protected]e96226872013-12-06 00:02:371// 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
tedchoc23990ba2015-10-29 18:48:488#include <string>
9
[email protected]e96226872013-12-06 00:02:3710#include "base/android/jni_android.h"
11#include "base/callback.h"
12#include "base/memory/scoped_ptr.h"
13#include "content/public/browser/web_contents_user_data.h"
14#include "content/public/common/context_menu_params.h"
tedchoc23990ba2015-10-29 18:48:4815#include "ui/gfx/geometry/size.h"
[email protected]e96226872013-12-06 00:02:3716
17namespace content {
18struct ContextMenuParams;
19class WebContents;
20}
21
22class ContextMenuHelper
23 : public content::WebContentsUserData<ContextMenuHelper> {
24 public:
dcheng361fdb32015-02-04 02:56:0725 ~ContextMenuHelper() override;
[email protected]e96226872013-12-06 00:02:3726
27 void ShowContextMenu(const content::ContextMenuParams& params);
28
[email protected]e96226872013-12-06 00:02:3729 void SetPopulator(jobject jpopulator);
30
31 // Methods called from Java via JNI ------------------------------------------
megjablon3d5616a2015-06-23 21:19:3732 void OnStartDownload(
33 JNIEnv* env, jobject obj, jboolean jis_link, jstring jheaders);
tedchoc23990ba2015-10-29 18:48:4834 void SearchForImage(JNIEnv* env, jobject obj);
35 void ShareImage(JNIEnv* env, jobject obj);
[email protected]e96226872013-12-06 00:02:3736
37 private:
38 explicit ContextMenuHelper(content::WebContents* web_contents);
39 friend class content::WebContentsUserData<ContextMenuHelper>;
40
41 static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams(
42 const content::ContextMenuParams& params);
43
tedchoc23990ba2015-10-29 18:48:4844 void OnShareImage(const std::string& thumbnail_data,
45 const gfx::Size& original_size);
46
[email protected]e96226872013-12-06 00:02:3747 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
48 content::WebContents* web_contents_;
49
[email protected]e96226872013-12-06 00:02:3750 content::ContextMenuParams context_menu_params_;
51
52 DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper);
53};
54
55bool RegisterContextMenuHelper(JNIEnv* env);
56
57#endif // CHROME_BROWSER_UI_ANDROID_CONTEXT_MENU_HELPER_H_