| 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_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "chrome/browser/favicon/favicon_tab_helper_observer.h" | 14 #include "chrome/browser/favicon/favicon_tab_helper_observer.h" |
| 15 #include "chrome/browser/search/instant_service_observer.h" | 15 #include "chrome/browser/search/instant_service_observer.h" |
| 16 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" | 16 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" |
| 17 #include "chrome/browser/ui/search/search_tab_helper_delegate.h" | 17 #include "chrome/browser/ui/search/search_tab_helper_delegate.h" |
| 18 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 18 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
| 19 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 19 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 20 #include "components/sessions/session_id.h" | 20 #include "components/sessions/session_id.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 | 23 |
| 24 class GURL; | 24 class GURL; |
| 25 class Profile; | 25 class Profile; |
| 26 class SkBitmap; | 26 class SkBitmap; |
| 27 | 27 |
| 28 namespace cc { | |
| 29 class Layer; | |
| 30 } | |
| 31 | |
| 32 namespace chrome { | 28 namespace chrome { |
| 33 struct NavigateParams; | 29 struct NavigateParams; |
| 34 } | 30 } |
| 35 | 31 |
| 36 namespace chrome { | 32 namespace chrome { |
| 37 namespace android { | 33 namespace android { |
| 38 class ChromeWebContentsDelegateAndroid; | 34 class ChromeWebContentsDelegateAndroid; |
| 39 class TabContentManager; | |
| 40 } | 35 } |
| 41 } | 36 } |
| 42 | 37 |
| 43 namespace content { | 38 namespace content { |
| 44 class ContentViewCore; | 39 class ContentViewCore; |
| 45 class WebContents; | 40 class WebContents; |
| 46 } | 41 } |
| 47 | 42 |
| 48 namespace prerender { | 43 namespace prerender { |
| 49 class PrerenderManager; | 44 class PrerenderManager; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 76 static void AttachTabHelpers(content::WebContents* web_contents); | 71 static void AttachTabHelpers(content::WebContents* web_contents); |
| 77 | 72 |
| 78 TabAndroid(JNIEnv* env, jobject obj); | 73 TabAndroid(JNIEnv* env, jobject obj); |
| 79 ~TabAndroid() override; | 74 ~TabAndroid() override; |
| 80 | 75 |
| 81 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 76 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 82 | 77 |
| 83 // Return the WebContents, if any, currently owned by this TabAndroid. | 78 // Return the WebContents, if any, currently owned by this TabAndroid. |
| 84 content::WebContents* web_contents() const { return web_contents_.get(); } | 79 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 85 | 80 |
| 86 // Return the cc::Layer that represents the content for this TabAndroid. | |
| 87 scoped_refptr<cc::Layer> GetContentLayer() const; | |
| 88 | |
| 89 // Return specific id information regarding this TabAndroid. | 81 // Return specific id information regarding this TabAndroid. |
| 90 const SessionID& session_id() const { return session_tab_id_; } | 82 const SessionID& session_id() const { return session_tab_id_; } |
| 91 int GetAndroidId() const; | 83 int GetAndroidId() const; |
| 92 int GetSyncId() const; | 84 int GetSyncId() const; |
| 93 | 85 |
| 94 // Return the tab title. | 86 // Return the tab title. |
| 95 base::string16 GetTitle() const; | 87 base::string16 GetTitle() const; |
| 96 | 88 |
| 97 // Return the tab url. | 89 // Return the tab url. |
| 98 GURL GetURL() const; | 90 GURL GetURL() const; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 jint constraints, | 179 jint constraints, |
| 188 jint current, | 180 jint current, |
| 189 jboolean animate); | 181 jboolean animate); |
| 190 | 182 |
| 191 void SearchByImageInNewTabAsync(JNIEnv* env, jobject obj); | 183 void SearchByImageInNewTabAsync(JNIEnv* env, jobject obj); |
| 192 | 184 |
| 193 void SetInterceptNavigationDelegate(JNIEnv* env, | 185 void SetInterceptNavigationDelegate(JNIEnv* env, |
| 194 jobject obj, | 186 jobject obj, |
| 195 jobject delegate); | 187 jobject delegate); |
| 196 | 188 |
| 197 // TODO(dtrainor): Remove this, pull content_layer() on demand. | |
| 198 void AttachToTabContentManager(JNIEnv* env, | |
| 199 jobject obj, | |
| 200 jobject jtab_content_manager); | |
| 201 | |
| 202 void AttachOverlayContentViewCore(JNIEnv* env, | |
| 203 jobject obj, | |
| 204 jobject jcontent_view_core, | |
| 205 jboolean visible); | |
| 206 | |
| 207 void DetachOverlayContentViewCore(JNIEnv* env, | |
| 208 jobject obj, | |
| 209 jobject jcontent_view_core); | |
| 210 | |
| 211 // Register the Tab's native methods through JNI. | 189 // Register the Tab's native methods through JNI. |
| 212 static bool RegisterTabAndroid(JNIEnv* env); | 190 static bool RegisterTabAndroid(JNIEnv* env); |
| 213 | 191 |
| 214 private: | 192 private: |
| 215 prerender::PrerenderManager* GetPrerenderManager() const; | 193 prerender::PrerenderManager* GetPrerenderManager() const; |
| 216 | 194 |
| 217 JavaObjectWeakGlobalRef weak_java_tab_; | 195 JavaObjectWeakGlobalRef weak_java_tab_; |
| 218 | 196 |
| 219 // The identifier used by session restore for this tab. | 197 // The identifier used by session restore for this tab. |
| 220 SessionID session_tab_id_; | 198 SessionID session_tab_id_; |
| 221 | 199 |
| 222 // Identifier of the window the tab is in. | 200 // Identifier of the window the tab is in. |
| 223 SessionID session_window_id_; | 201 SessionID session_window_id_; |
| 224 | 202 |
| 225 content::NotificationRegistrar notification_registrar_; | 203 content::NotificationRegistrar notification_registrar_; |
| 226 | 204 |
| 227 scoped_refptr<cc::Layer> content_layer_; | |
| 228 chrome::android::TabContentManager* tab_content_manager_; | |
| 229 | |
| 230 scoped_ptr<content::WebContents> web_contents_; | 205 scoped_ptr<content::WebContents> web_contents_; |
| 231 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> | 206 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> |
| 232 web_contents_delegate_; | 207 web_contents_delegate_; |
| 233 | 208 |
| 234 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; | 209 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; |
| 235 | 210 |
| 236 DISALLOW_COPY_AND_ASSIGN(TabAndroid); | 211 DISALLOW_COPY_AND_ASSIGN(TabAndroid); |
| 237 }; | 212 }; |
| 238 | 213 |
| 239 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ | 214 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
| OLD | NEW |