| 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 #include "chrome/browser/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" | 9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" |
| 10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void TabAndroid::OnNewTabPageReady() { | 251 void TabAndroid::OnNewTabPageReady() { |
| 252 NOTREACHED(); | 252 NOTREACHED(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 bool TabAndroid::ShouldWelcomePageLinkToTermsOfService() { | 255 bool TabAndroid::ShouldWelcomePageLinkToTermsOfService() { |
| 256 NOTIMPLEMENTED(); | 256 NOTIMPLEMENTED(); |
| 257 return false; | 257 return false; |
| 258 } | 258 } |
| 259 | 259 |
| 260 void TabAndroid::SwapTabContents(content::WebContents* old_contents, | 260 void TabAndroid::SwapTabContents(content::WebContents* old_contents, |
| 261 content::WebContents* new_contents) { | 261 content::WebContents* new_contents, |
| 262 bool did_start_load, |
| 263 bool did_finish_load) { |
| 262 JNIEnv* env = base::android::AttachCurrentThread(); | 264 JNIEnv* env = base::android::AttachCurrentThread(); |
| 263 | 265 |
| 264 // We need to notify the native InfobarContainer so infobars can be swapped. | 266 // We need to notify the native InfobarContainer so infobars can be swapped. |
| 265 InfoBarContainerAndroid* infobar_container = | 267 InfoBarContainerAndroid* infobar_container = |
| 266 reinterpret_cast<InfoBarContainerAndroid*>( | 268 reinterpret_cast<InfoBarContainerAndroid*>( |
| 267 Java_TabBase_getNativeInfoBarContainer( | 269 Java_TabBase_getNativeInfoBarContainer( |
| 268 env, | 270 env, |
| 269 weak_java_tab_.get(env).obj())); | 271 weak_java_tab_.get(env).obj())); |
| 270 InfoBarService* new_infobar_service = new_contents ? | 272 InfoBarService* new_infobar_service = new_contents ? |
| 271 InfoBarService::FromWebContents(new_contents) : NULL; | 273 InfoBarService::FromWebContents(new_contents) : NULL; |
| 272 infobar_container->ChangeInfoBarService(new_infobar_service); | 274 infobar_container->ChangeInfoBarService(new_infobar_service); |
| 273 | 275 |
| 274 Java_TabBase_swapWebContents( | 276 Java_TabBase_swapWebContents( |
| 275 env, | 277 env, |
| 276 weak_java_tab_.get(env).obj(), | 278 weak_java_tab_.get(env).obj(), |
| 277 reinterpret_cast<intptr_t>(new_contents)); | 279 reinterpret_cast<intptr_t>(new_contents), |
| 280 did_start_load, |
| 281 did_finish_load); |
| 278 } | 282 } |
| 279 | 283 |
| 280 void TabAndroid::Observe(int type, | 284 void TabAndroid::Observe(int type, |
| 281 const content::NotificationSource& source, | 285 const content::NotificationSource& source, |
| 282 const content::NotificationDetails& details) { | 286 const content::NotificationDetails& details) { |
| 283 JNIEnv* env = base::android::AttachCurrentThread(); | 287 JNIEnv* env = base::android::AttachCurrentThread(); |
| 284 switch (type) { | 288 switch (type) { |
| 285 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { | 289 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { |
| 286 TabSpecificContentSettings* settings = | 290 TabSpecificContentSettings* settings = |
| 287 TabSpecificContentSettings::FromWebContents(web_contents()); | 291 TabSpecificContentSettings::FromWebContents(web_contents()); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 464 |
| 461 static void Init(JNIEnv* env, jobject obj) { | 465 static void Init(JNIEnv* env, jobject obj) { |
| 462 TRACE_EVENT0("native", "TabAndroid::Init"); | 466 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 463 // This will automatically bind to the Java object and pass ownership there. | 467 // This will automatically bind to the Java object and pass ownership there. |
| 464 new TabAndroid(env, obj); | 468 new TabAndroid(env, obj); |
| 465 } | 469 } |
| 466 | 470 |
| 467 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 471 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 468 return RegisterNativesImpl(env); | 472 return RegisterNativesImpl(env); |
| 469 } | 473 } |
| OLD | NEW |