| 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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 742 |
| 743 int ContentViewCoreImpl::GetTopControlsHeightPix() const { | 743 int ContentViewCoreImpl::GetTopControlsHeightPix() const { |
| 744 JNIEnv* env = AttachCurrentThread(); | 744 JNIEnv* env = AttachCurrentThread(); |
| 745 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 745 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 746 if (j_obj.is_null()) | 746 if (j_obj.is_null()) |
| 747 return 0; | 747 return 0; |
| 748 return Java_ContentViewCore_getTopControlsHeightPix(env, j_obj.obj()); | 748 return Java_ContentViewCore_getTopControlsHeightPix(env, j_obj.obj()); |
| 749 } | 749 } |
| 750 | 750 |
| 751 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { | 751 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { |
| 752 return gfx::ToCeiledSize( | 752 return gfx::ScaleToCeiledSize(GetViewportSizePix(), 1.0f / dpi_scale()); |
| 753 gfx::ScaleSize(GetViewportSizePix(), 1.0f / dpi_scale())); | |
| 754 } | 753 } |
| 755 | 754 |
| 756 bool ContentViewCoreImpl::DoTopControlsShrinkBlinkSize() const { | 755 bool ContentViewCoreImpl::DoTopControlsShrinkBlinkSize() const { |
| 757 JNIEnv* env = AttachCurrentThread(); | 756 JNIEnv* env = AttachCurrentThread(); |
| 758 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 757 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 759 if (j_obj.is_null()) | 758 if (j_obj.is_null()) |
| 760 return false; | 759 return false; |
| 761 return Java_ContentViewCore_doTopControlsShrinkBlinkSize(env, j_obj.obj()); | 760 return Java_ContentViewCore_doTopControlsShrinkBlinkSize(env, j_obj.obj()); |
| 762 } | 761 } |
| 763 | 762 |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 return ScopedJavaLocalRef<jobject>(); | 1451 return ScopedJavaLocalRef<jobject>(); |
| 1453 | 1452 |
| 1454 return view->GetJavaObject(); | 1453 return view->GetJavaObject(); |
| 1455 } | 1454 } |
| 1456 | 1455 |
| 1457 bool RegisterContentViewCore(JNIEnv* env) { | 1456 bool RegisterContentViewCore(JNIEnv* env) { |
| 1458 return RegisterNativesImpl(env); | 1457 return RegisterNativesImpl(env); |
| 1459 } | 1458 } |
| 1460 | 1459 |
| 1461 } // namespace content | 1460 } // namespace content |
| OLD | NEW |