| 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 747 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 748 if (j_obj.is_null()) | 748 if (j_obj.is_null()) |
| 749 return size_pix = gfx::Size(); | 749 return size_pix = gfx::Size(); |
| 750 size_pix = gfx::Size( | 750 size_pix = gfx::Size( |
| 751 Java_ContentViewCore_getViewportWidthPix(env, j_obj), | 751 Java_ContentViewCore_getViewportWidthPix(env, j_obj), |
| 752 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj)); | 752 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj)); |
| 753 | 753 |
| 754 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); | 754 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); |
| 755 if (DoTopControlsShrinkBlinkSize()) | 755 if (DoTopControlsShrinkBlinkSize()) |
| 756 size_dip.Enlarge(0, -GetTopControlsHeightDip()); | 756 size_dip.Enlarge(0, -GetTopControlsHeightDip()); |
| 757 LOG(ERROR) << "bshe====" |
| 758 << "===get view size with OSK===" << size_dip.ToString(); |
| 757 return size_dip; | 759 return size_dip; |
| 758 } | 760 } |
| 759 | 761 |
| 760 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 762 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
| 761 gfx::Size size = GetViewportSizeDip(); | 763 gfx::Size size = GetViewportSizeDip(); |
| 762 if (DoTopControlsShrinkBlinkSize()) | 764 if (DoTopControlsShrinkBlinkSize()) |
| 763 size.Enlarge(0, -GetTopControlsHeightDip() - GetBottomControlsHeightDip()); | 765 size.Enlarge(0, -GetTopControlsHeightDip() - GetBottomControlsHeightDip()); |
| 766 LOG(ERROR) << "bshe====" |
| 767 << "===get view size===" << size.ToString(); |
| 764 return size; | 768 return size; |
| 765 } | 769 } |
| 766 | 770 |
| 767 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 771 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
| 768 JNIEnv* env = AttachCurrentThread(); | 772 JNIEnv* env = AttachCurrentThread(); |
| 769 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 773 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 770 if (j_obj.is_null()) | 774 if (j_obj.is_null()) |
| 771 return gfx::Size(); | 775 return gfx::Size(); |
| 772 return gfx::Size( | 776 return gfx::Size( |
| 773 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj), | 777 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj), |
| 774 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj)); | 778 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj)); |
| 775 } | 779 } |
| 776 | 780 |
| 777 gfx::Size ContentViewCoreImpl::GetViewportSizePix() const { | 781 gfx::Size ContentViewCoreImpl::GetViewportSizePix() const { |
| 778 JNIEnv* env = AttachCurrentThread(); | 782 JNIEnv* env = AttachCurrentThread(); |
| 779 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 783 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 780 if (j_obj.is_null()) | 784 if (j_obj.is_null()) |
| 781 return gfx::Size(); | 785 return gfx::Size(); |
| 786 LOG(ERROR) << "bshe====" |
| 787 << "===content view core view port size from java==="; |
| 782 return gfx::Size(Java_ContentViewCore_getViewportWidthPix(env, j_obj), | 788 return gfx::Size(Java_ContentViewCore_getViewportWidthPix(env, j_obj), |
| 783 Java_ContentViewCore_getViewportHeightPix(env, j_obj)); | 789 Java_ContentViewCore_getViewportHeightPix(env, j_obj)); |
| 784 } | 790 } |
| 785 | 791 |
| 786 int ContentViewCoreImpl::GetTopControlsHeightPix() const { | 792 int ContentViewCoreImpl::GetTopControlsHeightPix() const { |
| 787 JNIEnv* env = AttachCurrentThread(); | 793 JNIEnv* env = AttachCurrentThread(); |
| 788 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 794 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 789 if (j_obj.is_null()) | 795 if (j_obj.is_null()) |
| 790 return 0; | 796 return 0; |
| 791 return Java_ContentViewCore_getTopControlsHeightPix(env, j_obj); | 797 return Java_ContentViewCore_getTopControlsHeightPix(env, j_obj); |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 return ScopedJavaLocalRef<jobject>(); | 1608 return ScopedJavaLocalRef<jobject>(); |
| 1603 | 1609 |
| 1604 return view->GetJavaObject(); | 1610 return view->GetJavaObject(); |
| 1605 } | 1611 } |
| 1606 | 1612 |
| 1607 bool RegisterContentViewCore(JNIEnv* env) { | 1613 bool RegisterContentViewCore(JNIEnv* env) { |
| 1608 return RegisterNativesImpl(env); | 1614 return RegisterNativesImpl(env); |
| 1609 } | 1615 } |
| 1610 | 1616 |
| 1611 } // namespace content | 1617 } // namespace content |
| OLD | NEW |