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 "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 Java_ContentViewCore_showPastePopup(env, obj.obj(), static_cast<jint>(x), | 545 Java_ContentViewCore_showPastePopup(env, obj.obj(), static_cast<jint>(x), |
546 static_cast<jint>(y)); | 546 static_cast<jint>(y)); |
547 } | 547 } |
548 | 548 |
549 unsigned int ContentViewCoreImpl::GetScaledContentTexture( | 549 unsigned int ContentViewCoreImpl::GetScaledContentTexture( |
550 const gfx::Size& size) { | 550 const gfx::Size& size) { |
551 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 551 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
552 if (!view) | 552 if (!view) |
553 return 0; | 553 return 0; |
554 | 554 |
555 return view->GetScaledContentTexture(size); | 555 return GetScaledContentTexture(size, GetBounds()); |
no sievers
2012/12/17 21:20:02
Using GetBounds() here is racy during resizing, be
| |
556 } | |
557 | |
558 unsigned int ContentViewCoreImpl::GetScaledContentTexture( | |
559 const gfx::Size& size, | |
560 const gfx::Rect& src_rect) { | |
561 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | |
562 if (!view) | |
563 return 0; | |
564 | |
565 return view->GetScaledContentTexture(size, src_rect); | |
556 } | 566 } |
557 | 567 |
558 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 568 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
559 JNIEnv* env = AttachCurrentThread(); | 569 JNIEnv* env = AttachCurrentThread(); |
560 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 570 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
561 if (j_obj.is_null()) | 571 if (j_obj.is_null()) |
562 return; | 572 return; |
563 ScopedJavaLocalRef<jstring> jcontent_url = | 573 ScopedJavaLocalRef<jstring> jcontent_url = |
564 ConvertUTF8ToJavaString(env, content_url.spec()); | 574 ConvertUTF8ToJavaString(env, content_url.spec()); |
565 Java_ContentViewCore_startContentIntent(env, | 575 Java_ContentViewCore_startContentIntent(env, |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1282 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 1292 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
1283 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 1293 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
1284 return false; | 1294 return false; |
1285 } | 1295 } |
1286 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 1296 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
1287 | 1297 |
1288 return RegisterNativesImpl(env) >= 0; | 1298 return RegisterNativesImpl(env) >= 0; |
1289 } | 1299 } |
1290 | 1300 |
1291 } // namespace content | 1301 } // namespace content |
OLD | NEW |