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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { | 743 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { |
744 JNIEnv* env = AttachCurrentThread(); | 744 JNIEnv* env = AttachCurrentThread(); |
745 | 745 |
746 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 746 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
747 if (obj.is_null()) | 747 if (obj.is_null()) |
748 return ScopedJavaLocalRef<jobject>(); | 748 return ScopedJavaLocalRef<jobject>(); |
749 | 749 |
750 return Java_ContentViewCore_getContext(env, obj.obj()); | 750 return Java_ContentViewCore_getContext(env, obj.obj()); |
751 } | 751 } |
752 | 752 |
| 753 gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const { |
| 754 gfx::Size size_pix; |
| 755 JNIEnv* env = AttachCurrentThread(); |
| 756 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 757 if (j_obj.is_null()) |
| 758 return size_pix = gfx::Size(); |
| 759 size_pix = gfx::Size( |
| 760 Java_ContentViewCore_getViewportWidthPix(env, j_obj.obj()), |
| 761 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj.obj())); |
| 762 |
| 763 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); |
| 764 if (DoTopControlsShrinkBlinkSize()) |
| 765 size_dip.Enlarge(0, -GetTopControlsHeightDip()); |
| 766 return size_dip; |
| 767 } |
| 768 |
753 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 769 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
754 gfx::Size size = GetViewportSizeDip(); | 770 gfx::Size size = GetViewportSizeDip(); |
755 if (DoTopControlsShrinkBlinkSize()) | 771 if (DoTopControlsShrinkBlinkSize()) |
756 size.Enlarge(0, -GetTopControlsHeightDip()); | 772 size.Enlarge(0, -GetTopControlsHeightDip()); |
757 return size; | 773 return size; |
758 } | 774 } |
759 | 775 |
760 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 776 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
761 JNIEnv* env = AttachCurrentThread(); | 777 JNIEnv* env = AttachCurrentThread(); |
762 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 778 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 return ScopedJavaLocalRef<jobject>(); | 1553 return ScopedJavaLocalRef<jobject>(); |
1538 | 1554 |
1539 return view->GetJavaObject(); | 1555 return view->GetJavaObject(); |
1540 } | 1556 } |
1541 | 1557 |
1542 bool RegisterContentViewCore(JNIEnv* env) { | 1558 bool RegisterContentViewCore(JNIEnv* env) { |
1543 return RegisterNativesImpl(env); | 1559 return RegisterNativesImpl(env); |
1544 } | 1560 } |
1545 | 1561 |
1546 } // namespace content | 1562 } // namespace content |
OLD | NEW |