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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { | 763 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { |
764 JNIEnv* env = AttachCurrentThread(); | 764 JNIEnv* env = AttachCurrentThread(); |
765 | 765 |
766 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 766 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
767 if (obj.is_null()) | 767 if (obj.is_null()) |
768 return ScopedJavaLocalRef<jobject>(); | 768 return ScopedJavaLocalRef<jobject>(); |
769 | 769 |
770 return Java_ContentViewCore_getContext(env, obj.obj()); | 770 return Java_ContentViewCore_getContext(env, obj.obj()); |
771 } | 771 } |
772 | 772 |
| 773 gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const { |
| 774 gfx::Size size_pix; |
| 775 JNIEnv* env = AttachCurrentThread(); |
| 776 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 777 if (j_obj.is_null()) |
| 778 return size_pix = gfx::Size(); |
| 779 size_pix = gfx::Size( |
| 780 Java_ContentViewCore_getViewportWidthPix(env, j_obj.obj()), |
| 781 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj.obj())); |
| 782 |
| 783 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); |
| 784 if (DoTopControlsShrinkBlinkSize()) |
| 785 size_dip.Enlarge(0, -GetTopControlsHeightDip()); |
| 786 return size_dip; |
| 787 } |
| 788 |
773 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 789 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
774 gfx::Size size = GetViewportSizeDip(); | 790 gfx::Size size = GetViewportSizeDip(); |
775 if (DoTopControlsShrinkBlinkSize()) | 791 if (DoTopControlsShrinkBlinkSize()) |
776 size.Enlarge(0, -GetTopControlsHeightDip()); | 792 size.Enlarge(0, -GetTopControlsHeightDip()); |
777 return size; | 793 return size; |
778 } | 794 } |
779 | 795 |
780 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 796 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
781 JNIEnv* env = AttachCurrentThread(); | 797 JNIEnv* env = AttachCurrentThread(); |
782 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 798 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 return ScopedJavaLocalRef<jobject>(); | 1575 return ScopedJavaLocalRef<jobject>(); |
1560 | 1576 |
1561 return view->GetJavaObject(); | 1577 return view->GetJavaObject(); |
1562 } | 1578 } |
1563 | 1579 |
1564 bool RegisterContentViewCore(JNIEnv* env) { | 1580 bool RegisterContentViewCore(JNIEnv* env) { |
1565 return RegisterNativesImpl(env); | 1581 return RegisterNativesImpl(env); |
1566 } | 1582 } |
1567 | 1583 |
1568 } // namespace content | 1584 } // namespace content |
OLD | NEW |