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/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/browser/sessions/session_id.h" |
13 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 14 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 class SkBitmap; | 17 class SkBitmap; |
17 | 18 |
18 namespace browser_sync { | 19 namespace browser_sync { |
19 class SyncedTabDelegate; | 20 class SyncedTabDelegate; |
20 } | 21 } |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 struct ContextMenuParams; | 24 struct ContextMenuParams; |
24 class WebContents; | 25 class WebContents; |
25 } | 26 } |
26 | 27 |
27 class TabAndroid { | 28 class TabAndroid { |
28 public: | 29 public: |
29 TabAndroid(JNIEnv* env, jobject obj); | 30 TabAndroid(JNIEnv* env, jobject obj); |
30 | 31 |
31 // Convenience method to retrieve the Tab associated with the passed | 32 // Convenience method to retrieve the Tab associated with the passed |
32 // WebContents. Can return NULL. | 33 // WebContents. Can return NULL. |
33 static TabAndroid* FromWebContents(content::WebContents* web_contents); | 34 static TabAndroid* FromWebContents(content::WebContents* web_contents); |
34 | 35 |
35 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj); | 36 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj); |
36 | 37 |
37 // TODO(tedchoc): Make pure virtual once all derived classes can be updated. | 38 // TODO(tedchoc): Make pure virtual once all derived classes can be updated. |
38 virtual content::WebContents* GetWebContents(); | 39 virtual content::WebContents* GetWebContents(); |
39 | 40 |
40 virtual browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() = 0; | 41 virtual browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() = 0; |
41 | 42 |
| 43 virtual int64 GetSyncSessionId() = 0; |
| 44 virtual void SetSyncSessionId(int64 sync_id) = 0; |
| 45 |
42 virtual ToolbarModel::SecurityLevel GetSecurityLevel(); | 46 virtual ToolbarModel::SecurityLevel GetSecurityLevel(); |
43 | 47 |
44 int id() const { | 48 const SessionID& id() const { return tab_id_; } |
45 return tab_id_; | |
46 } | |
47 | 49 |
48 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, | 50 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, |
49 const string16& host, | 51 const string16& host, |
50 const string16& realm) = 0; | 52 const string16& realm) = 0; |
51 | 53 |
52 // Called to show the regular context menu that is triggered by a long press. | 54 // Called to show the regular context menu that is triggered by a long press. |
53 virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; | 55 virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; |
54 | 56 |
55 // Called to show a custom context menu. Used by the NTP. | 57 // Called to show a custom context menu. Used by the NTP. |
56 virtual void ShowCustomContextMenu( | 58 virtual void ShowCustomContextMenu( |
(...skipping 17 matching lines...) Expand all Loading... |
74 | 76 |
75 static bool RegisterTabAndroid(JNIEnv* env); | 77 static bool RegisterTabAndroid(JNIEnv* env); |
76 protected: | 78 protected: |
77 virtual ~TabAndroid(); | 79 virtual ~TabAndroid(); |
78 | 80 |
79 static void InitTabHelpers(content::WebContents* web_contents); | 81 static void InitTabHelpers(content::WebContents* web_contents); |
80 | 82 |
81 static content::WebContents* InitWebContentsFromView(JNIEnv* env, | 83 static content::WebContents* InitWebContentsFromView(JNIEnv* env, |
82 jobject content_view); | 84 jobject content_view); |
83 | 85 |
84 int tab_id_; | 86 SessionID tab_id_; |
85 | 87 |
86 private: | 88 private: |
87 JavaObjectWeakGlobalRef weak_java_tab_; | 89 JavaObjectWeakGlobalRef weak_java_tab_; |
88 }; | 90 }; |
89 | 91 |
90 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ | 92 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
OLD | NEW |