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()->SetDelegate(web_contents_delegate_.get()); |
| 448 } |
| 449 |
437 void TabAndroid::DestroyWebContents(JNIEnv* env, | 450 void TabAndroid::DestroyWebContents(JNIEnv* env, |
438 const JavaParamRef<jobject>& obj, | 451 const JavaParamRef<jobject>& obj, |
439 jboolean delete_native) { | 452 jboolean delete_native) { |
440 DCHECK(web_contents()); | 453 DCHECK(web_contents()); |
441 | 454 |
442 content::ContentViewCore* content_view_core = GetContentViewCore(); | 455 content::ContentViewCore* content_view_core = GetContentViewCore(); |
443 if (content_view_core) | 456 if (content_view_core) |
444 content_view_core->GetLayer()->RemoveFromParent(); | 457 content_view_core->GetLayer()->RemoveFromParent(); |
445 | 458 |
446 notification_registrar_.Remove( | 459 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) { | 930 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
918 TRACE_EVENT0("native", "TabAndroid::Init"); | 931 TRACE_EVENT0("native", "TabAndroid::Init"); |
919 // This will automatically bind to the Java object and pass ownership there. | 932 // This will automatically bind to the Java object and pass ownership there. |
920 new TabAndroid(env, obj); | 933 new TabAndroid(env, obj); |
921 } | 934 } |
922 | 935 |
923 // static | 936 // static |
924 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 937 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
925 return RegisterNativesImpl(env); | 938 return RegisterNativesImpl(env); |
926 } | 939 } |
OLD | NEW |