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 <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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { | 725 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { |
726 JNIEnv* env = AttachCurrentThread(); | 726 JNIEnv* env = AttachCurrentThread(); |
727 | 727 |
728 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 728 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
729 if (obj.is_null()) | 729 if (obj.is_null()) |
730 return ScopedJavaLocalRef<jobject>(); | 730 return ScopedJavaLocalRef<jobject>(); |
731 | 731 |
732 return Java_ContentViewCore_getContext(env, obj.obj()); | 732 return Java_ContentViewCore_getContext(env, obj.obj()); |
733 } | 733 } |
734 | 734 |
| 735 gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const { |
| 736 gfx::Size size_pix; |
| 737 JNIEnv* env = AttachCurrentThread(); |
| 738 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 739 if (j_obj.is_null()) |
| 740 return size_pix = gfx::Size(); |
| 741 size_pix = gfx::Size( |
| 742 Java_ContentViewCore_getViewportWidthPix(env, j_obj.obj()), |
| 743 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj.obj())); |
| 744 |
| 745 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); |
| 746 if (DoTopControlsShrinkBlinkSize()) |
| 747 size_dip.Enlarge(0, -GetTopControlsHeightDip()); |
| 748 return size_dip; |
| 749 } |
| 750 |
735 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 751 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
736 gfx::Size size = GetViewportSizeDip(); | 752 gfx::Size size = GetViewportSizeDip(); |
737 if (DoTopControlsShrinkBlinkSize()) | 753 if (DoTopControlsShrinkBlinkSize()) |
738 size.Enlarge(0, -GetTopControlsHeightDip()); | 754 size.Enlarge(0, -GetTopControlsHeightDip()); |
739 return size; | 755 return size; |
740 } | 756 } |
741 | 757 |
742 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 758 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
743 JNIEnv* env = AttachCurrentThread(); | 759 JNIEnv* env = AttachCurrentThread(); |
744 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 760 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 return ScopedJavaLocalRef<jobject>(); | 1537 return ScopedJavaLocalRef<jobject>(); |
1522 | 1538 |
1523 return view->GetJavaObject(); | 1539 return view->GetJavaObject(); |
1524 } | 1540 } |
1525 | 1541 |
1526 bool RegisterContentViewCore(JNIEnv* env) { | 1542 bool RegisterContentViewCore(JNIEnv* env) { |
1527 return RegisterNativesImpl(env); | 1543 return RegisterNativesImpl(env); |
1528 } | 1544 } |
1529 | 1545 |
1530 } // namespace content | 1546 } // namespace content |
OLD | NEW |