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" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "chrome/browser/sessions/session_id.h" | 13 #include "chrome/browser/sessions/session_id.h" |
14 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 14 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 class SkBitmap; | 17 class SkBitmap; |
18 | 18 |
19 namespace browser_sync { | 19 namespace browser_sync { |
20 class SyncedTabDelegate; | 20 class SyncedTabDelegate; |
21 } | 21 } |
22 | 22 |
23 namespace chrome { | |
24 struct NavigateParams; | |
25 } | |
26 | |
23 namespace content { | 27 namespace content { |
24 struct ContextMenuParams; | 28 struct ContextMenuParams; |
25 class WebContents; | 29 class WebContents; |
26 } | 30 } |
27 | 31 |
28 class TabAndroid { | 32 class TabAndroid { |
29 public: | 33 public: |
30 TabAndroid(JNIEnv* env, jobject obj); | 34 TabAndroid(JNIEnv* env, jobject obj); |
31 | 35 |
32 // Convenience method to retrieve the Tab associated with the passed | 36 // Convenience method to retrieve the Tab associated with the passed |
33 // WebContents. Can return NULL. | 37 // WebContents. Can return NULL. |
34 static TabAndroid* FromWebContents(content::WebContents* web_contents); | 38 static TabAndroid* FromWebContents(content::WebContents* web_contents); |
35 | 39 |
36 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj); | 40 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj); |
37 | 41 |
38 // TODO(tedchoc): Make pure virtual once all derived classes can be updated. | 42 // TODO(tedchoc): Make pure virtual once all derived classes can be updated. |
39 virtual content::WebContents* GetWebContents(); | 43 virtual content::WebContents* GetWebContents(); |
40 | 44 |
41 virtual browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() = 0; | 45 virtual browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() = 0; |
42 | 46 |
43 virtual ToolbarModel::SecurityLevel GetSecurityLevel(); | 47 virtual ToolbarModel::SecurityLevel GetSecurityLevel(); |
44 | 48 |
45 const SessionID& id() const { return tab_id_; } | 49 const SessionID& id() const { return tab_id_; } |
46 | 50 |
51 virtual void HandleNavigation(chrome::NavigateParams* params) = 0; | |
Yaron
2013/08/22 00:36:30
I don't think TestShell will link. To this end, co
| |
52 | |
47 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, | 53 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, |
48 const string16& host, | 54 const string16& host, |
49 const string16& realm) = 0; | 55 const string16& realm) = 0; |
50 | 56 |
51 // Called to show the regular context menu that is triggered by a long press. | 57 // Called to show the regular context menu that is triggered by a long press. |
52 virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; | 58 virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; |
53 | 59 |
54 // Called to show a custom context menu. Used by the NTP. | 60 // Called to show a custom context menu. Used by the NTP. |
55 virtual void ShowCustomContextMenu( | 61 virtual void ShowCustomContextMenu( |
56 const content::ContextMenuParams& params, | 62 const content::ContextMenuParams& params, |
(...skipping 26 matching lines...) Expand all Loading... | |
83 // TODO(jknotten): Remove this method. Making it non-abstract, so that | 89 // TODO(jknotten): Remove this method. Making it non-abstract, so that |
84 // derived classes may remove their implementation first. | 90 // derived classes may remove their implementation first. |
85 virtual void RunExternalProtocolDialog(const GURL& url); | 91 virtual void RunExternalProtocolDialog(const GURL& url); |
86 | 92 |
87 // Used by sync to get/set the sync id of tab. | 93 // Used by sync to get/set the sync id of tab. |
88 virtual int GetSyncId() const = 0; | 94 virtual int GetSyncId() const = 0; |
89 virtual void SetSyncId(int sync_id) = 0; | 95 virtual void SetSyncId(int sync_id) = 0; |
90 | 96 |
91 static bool RegisterTabAndroid(JNIEnv* env); | 97 static bool RegisterTabAndroid(JNIEnv* env); |
92 | 98 |
99 static void InitTabHelpers(content::WebContents* web_contents); | |
100 | |
93 protected: | 101 protected: |
94 virtual ~TabAndroid(); | 102 virtual ~TabAndroid(); |
95 | 103 |
96 static void InitTabHelpers(content::WebContents* web_contents); | |
97 | |
98 content::WebContents* InitWebContentsFromView(JNIEnv* env, | 104 content::WebContents* InitWebContentsFromView(JNIEnv* env, |
99 jobject content_view); | 105 jobject content_view); |
100 | 106 |
101 SessionID tab_id_; | 107 SessionID tab_id_; |
102 | 108 |
103 private: | 109 private: |
104 JavaObjectWeakGlobalRef weak_java_tab_; | 110 JavaObjectWeakGlobalRef weak_java_tab_; |
105 }; | 111 }; |
106 | 112 |
107 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ | 113 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
OLD | NEW |