| 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_finish_load) { | 
|  262   JNIEnv* env = base::android::AttachCurrentThread(); |  263   JNIEnv* env = base::android::AttachCurrentThread(); | 
|  263  |  264  | 
|  264   // We need to notify the native InfobarContainer so infobars can be swapped. |  265   // We need to notify the native InfobarContainer so infobars can be swapped. | 
|  265   InfoBarContainerAndroid* infobar_container = |  266   InfoBarContainerAndroid* infobar_container = | 
|  266       reinterpret_cast<InfoBarContainerAndroid*>( |  267       reinterpret_cast<InfoBarContainerAndroid*>( | 
|  267           Java_TabBase_getNativeInfoBarContainer( |  268           Java_TabBase_getNativeInfoBarContainer( | 
|  268               env, |  269               env, | 
|  269               weak_java_tab_.get(env).obj())); |  270               weak_java_tab_.get(env).obj())); | 
|  270   InfoBarService* new_infobar_service = new_contents ? |  271   InfoBarService* new_infobar_service = new_contents ? | 
|  271       InfoBarService::FromWebContents(new_contents) : NULL; |  272       InfoBarService::FromWebContents(new_contents) : NULL; | 
|  272   infobar_container->ChangeInfoBarService(new_infobar_service); |  273   infobar_container->ChangeInfoBarService(new_infobar_service); | 
|  273  |  274  | 
|  274   Java_TabBase_swapWebContents( |  275   Java_TabBase_swapWebContents( | 
|  275       env, |  276       env, | 
|  276       weak_java_tab_.get(env).obj(), |  277       weak_java_tab_.get(env).obj(), | 
|  277       reinterpret_cast<intptr_t>(new_contents)); |  278       reinterpret_cast<intptr_t>(new_contents), | 
 |  279       did_finish_load); | 
|  278 } |  280 } | 
|  279  |  281  | 
|  280 void TabAndroid::Observe(int type, |  282 void TabAndroid::Observe(int type, | 
|  281                          const content::NotificationSource& source, |  283                          const content::NotificationSource& source, | 
|  282                          const content::NotificationDetails& details) { |  284                          const content::NotificationDetails& details) { | 
|  283   JNIEnv* env = base::android::AttachCurrentThread(); |  285   JNIEnv* env = base::android::AttachCurrentThread(); | 
|  284   switch (type) { |  286   switch (type) { | 
|  285     case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { |  287     case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { | 
|  286       TabSpecificContentSettings* settings = |  288       TabSpecificContentSettings* settings = | 
|  287           TabSpecificContentSettings::FromWebContents(web_contents()); |  289           TabSpecificContentSettings::FromWebContents(web_contents()); | 
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  460  |  462  | 
|  461 static void Init(JNIEnv* env, jobject obj) { |  463 static void Init(JNIEnv* env, jobject obj) { | 
|  462   TRACE_EVENT0("native", "TabAndroid::Init"); |  464   TRACE_EVENT0("native", "TabAndroid::Init"); | 
|  463   // This will automatically bind to the Java object and pass ownership there. |  465   // This will automatically bind to the Java object and pass ownership there. | 
|  464   new TabAndroid(env, obj); |  466   new TabAndroid(env, obj); | 
|  465 } |  467 } | 
|  466  |  468  | 
|  467 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |  469 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 
|  468   return RegisterNativesImpl(env); |  470   return RegisterNativesImpl(env); | 
|  469 } |  471 } | 
| OLD | NEW |