OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 CHECK_EQ(GetProfile()->IsOffTheRecord(), incognito); | 427 CHECK_EQ(GetProfile()->IsOffTheRecord(), incognito); |
428 | 428 |
429 InstantService* instant_service = | 429 InstantService* instant_service = |
430 InstantServiceFactory::GetForProfile(GetProfile()); | 430 InstantServiceFactory::GetForProfile(GetProfile()); |
431 if (instant_service) | 431 if (instant_service) |
432 instant_service->AddObserver(this); | 432 instant_service->AddObserver(this); |
433 | 433 |
434 content_layer_->InsertChild(content_view_core->GetLayer(), 0); | 434 content_layer_->InsertChild(content_view_core->GetLayer(), 0); |
435 } | 435 } |
436 | 436 |
437 void TabAndroid::UpdateDelegates( | |
438 JNIEnv* env, | |
439 const JavaParamRef<jobject>& obj, | |
440 const JavaParamRef<jobject>& jweb_contents_delegate, | |
441 const JavaParamRef<jobject>& jcontext_menu_populator) { | |
442 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( | |
443 jcontext_menu_populator); | |
444 web_contents_delegate_.reset( | |
445 new chrome::android::TabWebContentsDelegateAndroid( | |
446 env, jweb_contents_delegate)); | |
447 web_contents_delegate_->LoadProgressChanged(web_contents(), 0); | |
gone
2016/02/24 18:40:37
What happens if the tab is reparented while the ta
| |
448 web_contents()->SetDelegate(web_contents_delegate_.get()); | |
449 } | |
450 | |
437 void TabAndroid::DestroyWebContents(JNIEnv* env, | 451 void TabAndroid::DestroyWebContents(JNIEnv* env, |
438 const JavaParamRef<jobject>& obj, | 452 const JavaParamRef<jobject>& obj, |
439 jboolean delete_native) { | 453 jboolean delete_native) { |
440 DCHECK(web_contents()); | 454 DCHECK(web_contents()); |
441 | 455 |
442 content::ContentViewCore* content_view_core = GetContentViewCore(); | 456 content::ContentViewCore* content_view_core = GetContentViewCore(); |
443 if (content_view_core) | 457 if (content_view_core) |
444 content_view_core->GetLayer()->RemoveFromParent(); | 458 content_view_core->GetLayer()->RemoveFromParent(); |
445 | 459 |
446 notification_registrar_.Remove( | 460 notification_registrar_.Remove( |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
917 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 931 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
918 TRACE_EVENT0("native", "TabAndroid::Init"); | 932 TRACE_EVENT0("native", "TabAndroid::Init"); |
919 // This will automatically bind to the Java object and pass ownership there. | 933 // This will automatically bind to the Java object and pass ownership there. |
920 new TabAndroid(env, obj); | 934 new TabAndroid(env, obj); |
921 } | 935 } |
922 | 936 |
923 // static | 937 // static |
924 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 938 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
925 return RegisterNativesImpl(env); | 939 return RegisterNativesImpl(env); |
926 } | 940 } |
OLD | NEW |