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 string16& host, | 81 const string16& host, |
83 const string16& realm) = 0; | 82 const 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 string16& title, const SkBitmap& skbitmap, | 87 const GURL& url, const 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 | 137 |
138 // TODO: Move out? | |
Ted C
2013/11/19 02:44:03
seems a bit lacking
David Trainor- moved to gerrit
2013/11/25 19:42:50
Done.
| |
139 void OnContextMenuDownload(JNIEnv* env, | |
140 jobject obj, | |
141 jstring jurl, | |
142 jboolean jis_link); | |
146 protected: | 143 protected: |
147 virtual ~TabAndroid(); | 144 virtual ~TabAndroid(); |
148 | 145 |
149 private: | 146 private: |
150 JavaObjectWeakGlobalRef weak_java_tab_; | 147 JavaObjectWeakGlobalRef weak_java_tab_; |
151 | 148 |
152 SessionID session_tab_id_; | 149 SessionID session_tab_id_; |
153 | 150 |
154 content::NotificationRegistrar notification_registrar_; | 151 content::NotificationRegistrar notification_registrar_; |
155 | 152 |
156 scoped_ptr<content::WebContents> web_contents_; | 153 scoped_ptr<content::WebContents> web_contents_; |
157 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> | 154 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> |
158 web_contents_delegate_; | 155 web_contents_delegate_; |
159 | 156 |
160 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; | 157 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; |
161 | 158 |
162 DISALLOW_COPY_AND_ASSIGN(TabAndroid); | 159 DISALLOW_COPY_AND_ASSIGN(TabAndroid); |
163 }; | 160 }; |
164 | 161 |
165 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ | 162 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
OLD | NEW |