blob: 0d10b30e20103aa61bf20ced7e40d0e01a476297 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
#define CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
#include <jni.h>
#include "base/android/scoped_java_ref.h"
#include "base/callback_forward.h"
#include "base/string16.h"
class GURL;
class SkBitmap;
class TabContents;
namespace browser_sync {
class SyncedTabDelegate;
}
namespace content {
struct ContextMenuParams;
class WebContents;
}
class TabAndroid {
public:
TabAndroid();
// Convenience method to retrieve the Tab associated with the passed
// WebContents. Can return NULL.
static TabAndroid* FromWebContents(content::WebContents* web_contents);
static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj);
// TODO(nileshagrawal): This should go away when all helpers
// have moved out of TabContents. crbug.com/153587
static TabContents* GetOrCreateTabContents(
content::WebContents* web_contents);
static TabContents* InitTabContentsFromView(JNIEnv* env,
jobject content_view);
virtual browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() = 0;
int id() const {
return tab_id_;
}
virtual void OnReceivedHttpAuthRequest(jobject auth_handler,
const string16& host,
const string16& realm) = 0;
// Called to show the regular context menu that is triggered by a long press.
virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0;
// Called to show a custom context menu. Used by the NTP.
virtual void ShowCustomContextMenu(
const content::ContextMenuParams& params,
const base::Callback<void(int)>& callback) = 0;
// Called when context menu option to create the bookmark shortcut on
// homescreen is called.
virtual void AddShortcutToBookmark(
const GURL& url, const string16& title, const SkBitmap& skbitmap,
int r_value, int g_value, int b_value) = 0;
// Called when the common ExternalProtocolHandler wants to
// run the external protocol dialog.
// TODO(jknotten): Remove this method. Making it non-abstract, so that
// derived classes may remove their implementation first.
virtual void RunExternalProtocolDialog(const GURL& url);
protected:
virtual ~TabAndroid();
static void InitTabHelpers(content::WebContents* web_contents);
int tab_id_;
};
#endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
|