| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { | 675 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { |
| 676 JNIEnv* env = AttachCurrentThread(); | 676 JNIEnv* env = AttachCurrentThread(); |
| 677 | 677 |
| 678 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 678 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 679 if (obj.is_null()) | 679 if (obj.is_null()) |
| 680 return ScopedJavaLocalRef<jobject>(); | 680 return ScopedJavaLocalRef<jobject>(); |
| 681 | 681 |
| 682 return Java_ContentViewCore_getContext(env, obj); | 682 return Java_ContentViewCore_getContext(env, obj); |
| 683 } | 683 } |
| 684 | 684 |
| 685 gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const { | |
| 686 gfx::Size size_pix; | |
| 687 JNIEnv* env = AttachCurrentThread(); | |
| 688 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | |
| 689 if (j_obj.is_null()) | |
| 690 return size_pix = gfx::Size(); | |
| 691 size_pix = gfx::Size( | |
| 692 Java_ContentViewCore_getViewportWidthPix(env, j_obj), | |
| 693 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj)); | |
| 694 | |
| 695 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); | |
| 696 if (DoBrowserControlsShrinkBlinkSize()) | |
| 697 size_dip.Enlarge(0, -GetTopControlsHeightDip()); | |
| 698 return size_dip; | |
| 699 } | |
| 700 | |
| 701 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 685 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
| 702 gfx::Size size = GetViewportSizeDip(); | 686 gfx::Size size = GetViewportSizeDip(); |
| 703 if (DoBrowserControlsShrinkBlinkSize()) | 687 if (DoBrowserControlsShrinkBlinkSize()) |
| 704 size.Enlarge(0, -GetTopControlsHeightDip() - GetBottomControlsHeightDip()); | 688 size.Enlarge(0, -GetTopControlsHeightDip() - GetBottomControlsHeightDip()); |
| 705 return size; | 689 return size; |
| 706 } | 690 } |
| 707 | 691 |
| 708 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 692 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
| 709 JNIEnv* env = AttachCurrentThread(); | 693 JNIEnv* env = AttachCurrentThread(); |
| 710 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 694 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 return ScopedJavaLocalRef<jobject>(); | 1308 return ScopedJavaLocalRef<jobject>(); |
| 1325 | 1309 |
| 1326 return view->GetJavaObject(); | 1310 return view->GetJavaObject(); |
| 1327 } | 1311 } |
| 1328 | 1312 |
| 1329 bool RegisterContentViewCore(JNIEnv* env) { | 1313 bool RegisterContentViewCore(JNIEnv* env) { |
| 1330 return RegisterNativesImpl(env); | 1314 return RegisterNativesImpl(env); |
| 1331 } | 1315 } |
| 1332 | 1316 |
| 1333 } // namespace content | 1317 } // namespace content |
| OLD | NEW |