| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { | 711 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const { |
| 712 JNIEnv* env = AttachCurrentThread(); | 712 JNIEnv* env = AttachCurrentThread(); |
| 713 | 713 |
| 714 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 714 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 715 if (obj.is_null()) | 715 if (obj.is_null()) |
| 716 return ScopedJavaLocalRef<jobject>(); | 716 return ScopedJavaLocalRef<jobject>(); |
| 717 | 717 |
| 718 return Java_ContentViewCore_getContext(env, obj.obj()); | 718 return Java_ContentViewCore_getContext(env, obj.obj()); |
| 719 } | 719 } |
| 720 | 720 |
| 721 gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const { |
| 722 gfx::Size size_pix; |
| 723 JNIEnv* env = AttachCurrentThread(); |
| 724 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 725 if (j_obj.is_null()) |
| 726 return size_pix = gfx::Size(); |
| 727 size_pix = gfx::Size( |
| 728 Java_ContentViewCore_getViewportWidthPix(env, j_obj.obj()), |
| 729 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj.obj())); |
| 730 |
| 731 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); |
| 732 if (DoTopControlsShrinkBlinkSize()) |
| 733 size_dip.Enlarge(0, -GetTopControlsHeightDip()); |
| 734 return size_dip; |
| 735 } |
| 736 |
| 721 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 737 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
| 722 gfx::Size size = GetViewportSizeDip(); | 738 gfx::Size size = GetViewportSizeDip(); |
| 723 if (DoTopControlsShrinkBlinkSize()) | 739 if (DoTopControlsShrinkBlinkSize()) |
| 724 size.Enlarge(0, -GetTopControlsHeightDip()); | 740 size.Enlarge(0, -GetTopControlsHeightDip()); |
| 725 return size; | 741 return size; |
| 726 } | 742 } |
| 727 | 743 |
| 728 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 744 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
| 729 JNIEnv* env = AttachCurrentThread(); | 745 JNIEnv* env = AttachCurrentThread(); |
| 730 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 746 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 return ScopedJavaLocalRef<jobject>(); | 1532 return ScopedJavaLocalRef<jobject>(); |
| 1517 | 1533 |
| 1518 return view->GetJavaObject(); | 1534 return view->GetJavaObject(); |
| 1519 } | 1535 } |
| 1520 | 1536 |
| 1521 bool RegisterContentViewCore(JNIEnv* env) { | 1537 bool RegisterContentViewCore(JNIEnv* env) { |
| 1522 return RegisterNativesImpl(env); | 1538 return RegisterNativesImpl(env); |
| 1523 } | 1539 } |
| 1524 | 1540 |
| 1525 } // namespace content | 1541 } // namespace content |
| OLD | NEW |