| 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_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 #include "content/public/browser/render_view_host.h" | 80 #include "content/public/browser/render_view_host.h" |
| 81 #include "content/public/browser/user_metrics.h" | 81 #include "content/public/browser/user_metrics.h" |
| 82 #include "content/public/browser/web_contents.h" | 82 #include "content/public/browser/web_contents.h" |
| 83 #include "content/public/common/resource_request_body.h" | 83 #include "content/public/common/resource_request_body.h" |
| 84 #include "content/public/common/top_controls_state.h" | 84 #include "content/public/common/top_controls_state.h" |
| 85 #include "jni/Tab_jni.h" | 85 #include "jni/Tab_jni.h" |
| 86 #include "net/base/escape.h" | 86 #include "net/base/escape.h" |
| 87 #include "skia/ext/image_operations.h" | 87 #include "skia/ext/image_operations.h" |
| 88 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 88 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 89 #include "ui/android/view_android.h" | 89 #include "ui/android/view_android.h" |
| 90 #include "ui/android/window_android.h" |
| 90 #include "ui/base/resource/resource_bundle.h" | 91 #include "ui/base/resource/resource_bundle.h" |
| 91 #include "ui/base/window_open_disposition.h" | 92 #include "ui/base/window_open_disposition.h" |
| 92 #include "ui/display/display.h" | 93 #include "ui/display/display.h" |
| 93 #include "ui/display/screen.h" | 94 #include "ui/display/screen.h" |
| 94 #include "ui/gfx/android/java_bitmap.h" | 95 #include "ui/gfx/android/java_bitmap.h" |
| 95 #include "ui/gfx/favicon_size.h" | 96 #include "ui/gfx/favicon_size.h" |
| 96 #include "ui/gfx/image/image_skia.h" | 97 #include "ui/gfx/image/image_skia.h" |
| 97 | 98 |
| 98 using base::android::AttachCurrentThread; | 99 using base::android::AttachCurrentThread; |
| 99 using base::android::ConvertUTF8ToJavaString; | 100 using base::android::ConvertUTF8ToJavaString; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 InstantServiceFactory::GetForProfile(GetProfile()); | 416 InstantServiceFactory::GetForProfile(GetProfile()); |
| 416 if (instant_service) | 417 if (instant_service) |
| 417 instant_service->AddObserver(this); | 418 instant_service->AddObserver(this); |
| 418 | 419 |
| 419 content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0); | 420 content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0); |
| 420 } | 421 } |
| 421 | 422 |
| 422 base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents( | 423 base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents( |
| 423 JNIEnv* env, | 424 JNIEnv* env, |
| 424 const JavaParamRef<jobject>& obj, | 425 const JavaParamRef<jobject>& obj, |
| 425 const JavaParamRef<jobject>& j_profile) { | 426 const JavaParamRef<jobject>& j_profile, |
| 427 jlong window_android_ptr) { |
| 426 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile.obj()); | 428 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile.obj()); |
| 427 DCHECK(!profile->IsOffTheRecord()); | 429 DCHECK(!profile->IsOffTheRecord()); |
| 428 blimp::client::BlimpClientContext* context = | 430 blimp::client::BlimpClientContext* context = |
| 429 BlimpClientContextFactory::GetForBrowserContext(profile); | 431 BlimpClientContextFactory::GetForBrowserContext(profile); |
| 430 DCHECK(context); | 432 DCHECK(context); |
| 431 blimp_contents_ = context->CreateBlimpContents(); | 433 ui::WindowAndroid* window = |
| 434 reinterpret_cast<ui::WindowAndroid*>(window_android_ptr); |
| 435 blimp_contents_ = context->CreateBlimpContents(window); |
| 432 DCHECK(blimp_contents_); | 436 DCHECK(blimp_contents_); |
| 433 return blimp_contents_->GetJavaObject(); | 437 return blimp_contents_->GetJavaObject(); |
| 434 } | 438 } |
| 435 | 439 |
| 436 void TabAndroid::UpdateDelegates( | 440 void TabAndroid::UpdateDelegates( |
| 437 JNIEnv* env, | 441 JNIEnv* env, |
| 438 const JavaParamRef<jobject>& obj, | 442 const JavaParamRef<jobject>& obj, |
| 439 const JavaParamRef<jobject>& jweb_contents_delegate, | 443 const JavaParamRef<jobject>& jweb_contents_delegate, |
| 440 const JavaParamRef<jobject>& jcontext_menu_populator) { | 444 const JavaParamRef<jobject>& jcontext_menu_populator) { |
| 441 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( | 445 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 902 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 899 TRACE_EVENT0("native", "TabAndroid::Init"); | 903 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 900 // This will automatically bind to the Java object and pass ownership there. | 904 // This will automatically bind to the Java object and pass ownership there. |
| 901 new TabAndroid(env, obj); | 905 new TabAndroid(env, obj); |
| 902 } | 906 } |
| 903 | 907 |
| 904 // static | 908 // static |
| 905 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 909 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 906 return RegisterNativesImpl(env); | 910 return RegisterNativesImpl(env); |
| 907 } | 911 } |
| OLD | NEW |