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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 gfx::Size size_pix; | 719 gfx::Size size_pix; |
720 JNIEnv* env = AttachCurrentThread(); | 720 JNIEnv* env = AttachCurrentThread(); |
721 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 721 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
722 if (j_obj.is_null()) | 722 if (j_obj.is_null()) |
723 return size_pix = gfx::Size(); | 723 return size_pix = gfx::Size(); |
724 size_pix = gfx::Size( | 724 size_pix = gfx::Size( |
725 Java_ContentViewCore_getViewportWidthPix(env, j_obj), | 725 Java_ContentViewCore_getViewportWidthPix(env, j_obj), |
726 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj)); | 726 Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj)); |
727 | 727 |
728 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); | 728 gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale()); |
729 if (DoTopControlsShrinkBlinkSize()) | 729 if (DoBrowserControlsShrinkBlinkSize()) |
730 size_dip.Enlarge(0, -GetTopControlsHeightDip()); | 730 size_dip.Enlarge(0, -GetTopControlsHeightDip()); |
731 return size_dip; | 731 return size_dip; |
732 } | 732 } |
733 | 733 |
734 gfx::Size ContentViewCoreImpl::GetViewSize() const { | 734 gfx::Size ContentViewCoreImpl::GetViewSize() const { |
735 gfx::Size size = GetViewportSizeDip(); | 735 gfx::Size size = GetViewportSizeDip(); |
736 if (DoTopControlsShrinkBlinkSize()) | 736 if (DoBrowserControlsShrinkBlinkSize()) |
737 size.Enlarge(0, -GetTopControlsHeightDip() - GetBottomControlsHeightDip()); | 737 size.Enlarge(0, -GetTopControlsHeightDip() - GetBottomControlsHeightDip()); |
738 return size; | 738 return size; |
739 } | 739 } |
740 | 740 |
741 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 741 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
742 JNIEnv* env = AttachCurrentThread(); | 742 JNIEnv* env = AttachCurrentThread(); |
743 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 743 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
744 if (j_obj.is_null()) | 744 if (j_obj.is_null()) |
745 return gfx::Size(); | 745 return gfx::Size(); |
746 return gfx::Size( | 746 return gfx::Size( |
(...skipping 23 matching lines...) Expand all Loading... |
770 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 770 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
771 if (j_obj.is_null()) | 771 if (j_obj.is_null()) |
772 return 0; | 772 return 0; |
773 return Java_ContentViewCore_getBottomControlsHeightPix(env, j_obj); | 773 return Java_ContentViewCore_getBottomControlsHeightPix(env, j_obj); |
774 } | 774 } |
775 | 775 |
776 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { | 776 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { |
777 return gfx::ScaleToCeiledSize(GetViewportSizePix(), 1.0f / dpi_scale()); | 777 return gfx::ScaleToCeiledSize(GetViewportSizePix(), 1.0f / dpi_scale()); |
778 } | 778 } |
779 | 779 |
780 bool ContentViewCoreImpl::DoTopControlsShrinkBlinkSize() const { | 780 bool ContentViewCoreImpl::DoBrowserControlsShrinkBlinkSize() const { |
781 JNIEnv* env = AttachCurrentThread(); | 781 JNIEnv* env = AttachCurrentThread(); |
782 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 782 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
783 if (j_obj.is_null()) | 783 if (j_obj.is_null()) |
784 return false; | 784 return false; |
785 return Java_ContentViewCore_doTopControlsShrinkBlinkSize(env, j_obj); | 785 return Java_ContentViewCore_doBrowserControlsShrinkBlinkSize(env, j_obj); |
786 } | 786 } |
787 | 787 |
788 float ContentViewCoreImpl::GetTopControlsHeightDip() const { | 788 float ContentViewCoreImpl::GetTopControlsHeightDip() const { |
789 return GetTopControlsHeightPix() / dpi_scale(); | 789 return GetTopControlsHeightPix() / dpi_scale(); |
790 } | 790 } |
791 | 791 |
792 float ContentViewCoreImpl::GetBottomControlsHeightDip() const { | 792 float ContentViewCoreImpl::GetBottomControlsHeightDip() const { |
793 return GetBottomControlsHeightPix() / dpi_scale(); | 793 return GetBottomControlsHeightPix() / dpi_scale(); |
794 } | 794 } |
795 | 795 |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 return ScopedJavaLocalRef<jobject>(); | 1567 return ScopedJavaLocalRef<jobject>(); |
1568 | 1568 |
1569 return view->GetJavaObject(); | 1569 return view->GetJavaObject(); |
1570 } | 1570 } |
1571 | 1571 |
1572 bool RegisterContentViewCore(JNIEnv* env) { | 1572 bool RegisterContentViewCore(JNIEnv* env) { |
1573 return RegisterNativesImpl(env); | 1573 return RegisterNativesImpl(env); |
1574 } | 1574 } |
1575 | 1575 |
1576 } // namespace content | 1576 } // namespace content |
OLD | NEW |