OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ANDROID_TAB_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
6 #define CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/jni_helper.h" | 10 #include "base/android/jni_helper.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 namespace chrome { | 29 namespace chrome { |
30 namespace android { | 30 namespace android { |
31 class ChromeWebContentsDelegateAndroid; | 31 class ChromeWebContentsDelegateAndroid; |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 class ContentViewCore; | 36 class ContentViewCore; |
37 struct ContextMenuParams; | |
38 class WebContents; | 37 class WebContents; |
39 } | 38 } |
40 | 39 |
41 class TabAndroid : public CoreTabHelperDelegate, | 40 class TabAndroid : public CoreTabHelperDelegate, |
42 public content::NotificationObserver { | 41 public content::NotificationObserver { |
43 public: | 42 public: |
44 // Convenience method to retrieve the Tab associated with the passed | 43 // Convenience method to retrieve the Tab associated with the passed |
45 // WebContents. Can return NULL. | 44 // WebContents. Can return NULL. |
46 static TabAndroid* FromWebContents(content::WebContents* web_contents); | 45 static TabAndroid* FromWebContents(content::WebContents* web_contents); |
47 | 46 |
(...skipping 27 matching lines...) Expand all Loading... |
75 browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() const; | 74 browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() const; |
76 | 75 |
77 void SetSyncId(int sync_id); | 76 void SetSyncId(int sync_id); |
78 | 77 |
79 virtual void HandlePopupNavigation(chrome::NavigateParams* params) = 0; | 78 virtual void HandlePopupNavigation(chrome::NavigateParams* params) = 0; |
80 | 79 |
81 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, | 80 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, |
82 const base::string16& host, | 81 const base::string16& host, |
83 const base::string16& realm) = 0; | 82 const base::string16& realm) = 0; |
84 | 83 |
85 // Called to show the regular context menu that is triggered by a long press. | |
86 virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; | |
87 | |
88 // Called to show a custom context menu. Used by the NTP. | |
89 virtual void ShowCustomContextMenu( | |
90 const content::ContextMenuParams& params, | |
91 const base::Callback<void(int)>& callback) = 0; | |
92 | |
93 // Called when context menu option to create the bookmark shortcut on | 84 // Called when context menu option to create the bookmark shortcut on |
94 // homescreen is called. | 85 // homescreen is called. |
95 virtual void AddShortcutToBookmark( | 86 virtual void AddShortcutToBookmark( |
96 const GURL& url, const base::string16& title, const SkBitmap& skbitmap, | 87 const GURL& url, const base::string16& title, const SkBitmap& skbitmap, |
97 int r_value, int g_value, int b_value) = 0; | 88 int r_value, int g_value, int b_value) = 0; |
98 | 89 |
99 // Called when a bookmark node should be edited. | 90 // Called when a bookmark node should be edited. |
100 virtual void EditBookmark(int64 node_id, | 91 virtual void EditBookmark(int64 node_id, |
101 const base::string16& node_title, | 92 const base::string16& node_title, |
102 bool is_folder, | 93 bool is_folder, |
(...skipping 20 matching lines...) Expand all Loading... |
123 virtual void Observe(int type, | 114 virtual void Observe(int type, |
124 const content::NotificationSource& source, | 115 const content::NotificationSource& source, |
125 const content::NotificationDetails& details) OVERRIDE; | 116 const content::NotificationDetails& details) OVERRIDE; |
126 | 117 |
127 // Methods called from Java via JNI ----------------------------------------- | 118 // Methods called from Java via JNI ----------------------------------------- |
128 | 119 |
129 virtual void InitWebContents(JNIEnv* env, | 120 virtual void InitWebContents(JNIEnv* env, |
130 jobject obj, | 121 jobject obj, |
131 jboolean incognito, | 122 jboolean incognito, |
132 jobject jcontent_view_core, | 123 jobject jcontent_view_core, |
133 jobject jweb_contents_delegate); | 124 jobject jweb_contents_delegate, |
| 125 jobject jcontext_menu_populator); |
134 | 126 |
135 virtual void DestroyWebContents(JNIEnv* env, | 127 virtual void DestroyWebContents(JNIEnv* env, |
136 jobject obj, | 128 jobject obj, |
137 jboolean delete_native); | 129 jboolean delete_native); |
138 base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, | 130 base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, |
139 jobject obj); | 131 jobject obj); |
140 ToolbarModel::SecurityLevel GetSecurityLevel(JNIEnv* env, jobject obj); | 132 ToolbarModel::SecurityLevel GetSecurityLevel(JNIEnv* env, jobject obj); |
141 void SetActiveNavigationEntryTitleForUrl(JNIEnv* env, | 133 void SetActiveNavigationEntryTitleForUrl(JNIEnv* env, |
142 jobject obj, | 134 jobject obj, |
143 jstring jurl, | 135 jstring jurl, |
144 jstring jtitle); | 136 jstring jtitle); |
145 | |
146 bool Print(JNIEnv* env, jobject obj); | 137 bool Print(JNIEnv* env, jobject obj); |
147 | 138 |
148 protected: | 139 protected: |
149 virtual ~TabAndroid(); | 140 virtual ~TabAndroid(); |
150 | 141 |
151 private: | 142 private: |
152 JavaObjectWeakGlobalRef weak_java_tab_; | 143 JavaObjectWeakGlobalRef weak_java_tab_; |
153 | 144 |
154 SessionID session_tab_id_; | 145 SessionID session_tab_id_; |
155 | 146 |
156 content::NotificationRegistrar notification_registrar_; | 147 content::NotificationRegistrar notification_registrar_; |
157 | 148 |
158 scoped_ptr<content::WebContents> web_contents_; | 149 scoped_ptr<content::WebContents> web_contents_; |
159 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> | 150 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> |
160 web_contents_delegate_; | 151 web_contents_delegate_; |
161 | 152 |
162 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; | 153 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; |
163 | 154 |
164 DISALLOW_COPY_AND_ASSIGN(TabAndroid); | 155 DISALLOW_COPY_AND_ASSIGN(TabAndroid); |
165 }; | 156 }; |
166 | 157 |
167 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ | 158 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
OLD | NEW |