Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 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 class WebContents; | 37 class WebContents; |
| 38 } | 38 } |
| 39 | 39 |
| 40 namespace prerender { | |
| 41 class PrerenderManager; | |
| 42 } | |
| 43 | |
| 40 class TabAndroid : public CoreTabHelperDelegate, | 44 class TabAndroid : public CoreTabHelperDelegate, |
| 41 public content::NotificationObserver { | 45 public content::NotificationObserver { |
| 42 public: | 46 public: |
| 47 enum TabLoadStatus { | |
| 48 #define DEFINE_TAB_LOAD_STATUS(name,value) name = value, | |
|
David Trainor- moved to gerrit
2014/03/06 22:21:32
space before value?
Ted C
2014/03/06 22:30:43
Done.
| |
| 49 #include "chrome/browser/android/tab_load_status.h" | |
| 50 #undef DEFINE_TAB_LOAD_STATUS | |
| 51 }; | |
| 52 | |
| 43 // Convenience method to retrieve the Tab associated with the passed | 53 // Convenience method to retrieve the Tab associated with the passed |
| 44 // WebContents. Can return NULL. | 54 // WebContents. Can return NULL. |
| 45 static TabAndroid* FromWebContents(content::WebContents* web_contents); | 55 static TabAndroid* FromWebContents(content::WebContents* web_contents); |
| 46 | 56 |
| 47 // Returns the native TabAndroid stored in the Java Tab represented by | 57 // Returns the native TabAndroid stored in the Java Tab represented by |
| 48 // |obj|. | 58 // |obj|. |
| 49 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj); | 59 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj); |
| 50 | 60 |
| 51 TabAndroid(JNIEnv* env, jobject obj); | 61 TabAndroid(JNIEnv* env, jobject obj); |
| 52 virtual ~TabAndroid(); | 62 virtual ~TabAndroid(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 bool is_folder, | 110 bool is_folder, |
| 101 bool is_partner_bookmark); | 111 bool is_partner_bookmark); |
| 102 | 112 |
| 103 // Called to notify that the new tab page has completely rendered. | 113 // Called to notify that the new tab page has completely rendered. |
| 104 virtual void OnNewTabPageReady(); | 114 virtual void OnNewTabPageReady(); |
| 105 | 115 |
| 106 // Called to determine if chrome://welcome should contain links to the terms | 116 // Called to determine if chrome://welcome should contain links to the terms |
| 107 // of service and the privacy notice. | 117 // of service and the privacy notice. |
| 108 virtual bool ShouldWelcomePageLinkToTermsOfService(); | 118 virtual bool ShouldWelcomePageLinkToTermsOfService(); |
| 109 | 119 |
| 110 // Register the Tab's native methods through JNI. | 120 bool HasPrerenderedUrl(GURL gurl); |
| 111 static bool RegisterTabAndroid(JNIEnv* env); | |
| 112 | 121 |
| 113 // CoreTabHelperDelegate ---------------------------------------------------- | 122 // CoreTabHelperDelegate ---------------------------------------------------- |
| 114 | 123 |
| 115 virtual void SwapTabContents(content::WebContents* old_contents, | 124 virtual void SwapTabContents(content::WebContents* old_contents, |
| 116 content::WebContents* new_contents, | 125 content::WebContents* new_contents, |
| 117 bool did_start_load, | 126 bool did_start_load, |
| 118 bool did_finish_load) OVERRIDE; | 127 bool did_finish_load) OVERRIDE; |
| 119 | 128 |
| 120 // NotificationObserver ----------------------------------------------------- | 129 // NotificationObserver ----------------------------------------------------- |
| 121 virtual void Observe(int type, | 130 virtual void Observe(int type, |
| 122 const content::NotificationSource& source, | 131 const content::NotificationSource& source, |
| 123 const content::NotificationDetails& details) OVERRIDE; | 132 const content::NotificationDetails& details) OVERRIDE; |
| 124 | 133 |
| 125 // Methods called from Java via JNI ----------------------------------------- | 134 // Methods called from Java via JNI ----------------------------------------- |
| 126 | 135 |
| 127 virtual void Destroy(JNIEnv* env, jobject obj); | 136 virtual void Destroy(JNIEnv* env, jobject obj); |
| 128 virtual void InitWebContents(JNIEnv* env, | 137 virtual void InitWebContents(JNIEnv* env, |
| 129 jobject obj, | 138 jobject obj, |
| 130 jboolean incognito, | 139 jboolean incognito, |
| 131 jobject jcontent_view_core, | 140 jobject jcontent_view_core, |
| 132 jobject jweb_contents_delegate, | 141 jobject jweb_contents_delegate, |
| 133 jobject jcontext_menu_populator); | 142 jobject jcontext_menu_populator); |
| 134 virtual void DestroyWebContents(JNIEnv* env, | 143 virtual void DestroyWebContents(JNIEnv* env, |
| 135 jobject obj, | 144 jobject obj, |
| 136 jboolean delete_native); | 145 jboolean delete_native); |
| 137 base::android::ScopedJavaLocalRef<jobject> GetWebContents(JNIEnv* env, | 146 base::android::ScopedJavaLocalRef<jobject> GetWebContents(JNIEnv* env, |
| 138 jobject obj); | 147 jobject obj); |
| 139 base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, | 148 base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, |
| 140 jobject obj); | 149 jobject obj); |
| 150 virtual TabLoadStatus LoadUrl(JNIEnv* env, | |
| 151 jobject obj, | |
| 152 jstring url, | |
| 153 jstring j_extra_headers, | |
| 154 jbyteArray j_post_data, | |
| 155 jint page_transition, | |
| 156 jstring j_referrer_url, | |
| 157 jint referrer_policy); | |
| 141 ToolbarModel::SecurityLevel GetSecurityLevel(JNIEnv* env, jobject obj); | 158 ToolbarModel::SecurityLevel GetSecurityLevel(JNIEnv* env, jobject obj); |
| 142 void SetActiveNavigationEntryTitleForUrl(JNIEnv* env, | 159 void SetActiveNavigationEntryTitleForUrl(JNIEnv* env, |
| 143 jobject obj, | 160 jobject obj, |
| 144 jstring jurl, | 161 jstring jurl, |
| 145 jstring jtitle); | 162 jstring jtitle); |
| 146 bool Print(JNIEnv* env, jobject obj); | 163 bool Print(JNIEnv* env, jobject obj); |
| 147 | 164 |
| 165 // Register the Tab's native methods through JNI. | |
| 166 static bool RegisterTabAndroid(JNIEnv* env); | |
| 167 | |
| 148 private: | 168 private: |
| 169 prerender::PrerenderManager* GetPrerenderManager() const; | |
| 170 | |
| 149 JavaObjectWeakGlobalRef weak_java_tab_; | 171 JavaObjectWeakGlobalRef weak_java_tab_; |
| 150 | 172 |
| 151 // The identifier used by session restore for this tab. | 173 // The identifier used by session restore for this tab. |
| 152 SessionID session_tab_id_; | 174 SessionID session_tab_id_; |
| 153 | 175 |
| 154 // Identifier of the window the tab is in. | 176 // Identifier of the window the tab is in. |
| 155 SessionID session_window_id_; | 177 SessionID session_window_id_; |
| 156 | 178 |
| 157 content::NotificationRegistrar notification_registrar_; | 179 content::NotificationRegistrar notification_registrar_; |
| 158 | 180 |
| 159 scoped_ptr<content::WebContents> web_contents_; | 181 scoped_ptr<content::WebContents> web_contents_; |
| 160 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> | 182 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> |
| 161 web_contents_delegate_; | 183 web_contents_delegate_; |
| 162 | 184 |
| 163 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; | 185 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; |
| 164 | 186 |
| 165 DISALLOW_COPY_AND_ASSIGN(TabAndroid); | 187 DISALLOW_COPY_AND_ASSIGN(TabAndroid); |
| 166 }; | 188 }; |
| 167 | 189 |
| 168 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ | 190 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ |
| OLD | NEW |