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 "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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { | 702 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { |
703 JNIEnv* env = AttachCurrentThread(); | 703 JNIEnv* env = AttachCurrentThread(); |
704 | 704 |
705 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 705 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
706 if (obj.is_null()) | 706 if (obj.is_null()) |
707 return ScopedJavaLocalRef<jobject>(); | 707 return ScopedJavaLocalRef<jobject>(); |
708 | 708 |
709 return Java_ContentViewCore_getContext(env, obj.obj()); | 709 return Java_ContentViewCore_getContext(env, obj.obj()); |
710 } | 710 } |
711 | 711 |
| 712 gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const { |
| 713 gfx::Size size_pix; |
| 714 JNIEnv* env = AttachCurrentThread(); |
| 715 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 716 if (j_obj.is_null()) |
| 717 return size_pix = gfx::Size(); |
| 718 size_pix = gfx::Size( |
| 719 Java_ContentViewCore_getViewportWidthPix(env, j_obj.obj()), |
| 720 Java_ContentViewCore_getViewportHeightWithoutOSKPix(env, j_obj.obj())); |
| 721 |
| 722 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); |
| 723 if (DoTopControlsShrinkBlinkSize()) |
| 724 size_dip.Enlarge(0, -GetTopControlsHeightDip()); |
| 725 return size_dip; |
| 726 } |
| 727 |
712 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 728 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
713 gfx::Size size = GetViewportSizeDip(); | 729 gfx::Size size = GetViewportSizeDip(); |
714 if (DoTopControlsShrinkBlinkSize()) | 730 if (DoTopControlsShrinkBlinkSize()) |
715 size.Enlarge(0, -GetTopControlsHeightDip()); | 731 size.Enlarge(0, -GetTopControlsHeightDip()); |
716 return size; | 732 return size; |
717 } | 733 } |
718 | 734 |
719 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 735 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
720 JNIEnv* env = AttachCurrentThread(); | 736 JNIEnv* env = AttachCurrentThread(); |
721 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 737 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 return ScopedJavaLocalRef<jobject>(); | 1463 return ScopedJavaLocalRef<jobject>(); |
1448 | 1464 |
1449 return view->GetJavaObject(); | 1465 return view->GetJavaObject(); |
1450 } | 1466 } |
1451 | 1467 |
1452 bool RegisterContentViewCore(JNIEnv* env) { | 1468 bool RegisterContentViewCore(JNIEnv* env) { |
1453 return RegisterNativesImpl(env); | 1469 return RegisterNativesImpl(env); |
1454 } | 1470 } |
1455 | 1471 |
1456 } // namespace content | 1472 } // namespace content |
OLD | NEW |