Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 714003002: Allow changing top controls height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 710
711 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 711 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
712 if (obj.is_null()) 712 if (obj.is_null())
713 return ScopedJavaLocalRef<jobject>(); 713 return ScopedJavaLocalRef<jobject>();
714 714
715 return Java_ContentViewCore_getContext(env, obj.obj()); 715 return Java_ContentViewCore_getContext(env, obj.obj());
716 } 716 }
717 717
718 gfx::Size ContentViewCoreImpl::GetViewSize() const { 718 gfx::Size ContentViewCoreImpl::GetViewSize() const {
719 gfx::Size size = GetViewportSizeDip(); 719 gfx::Size size = GetViewportSizeDip();
720 size.Enlarge(0, -GetTopControlsLayoutHeightDip()); 720 if (GetTopControlsShrinkBlinkSize())
721 size.Enlarge(0, -GetTopControlsHeightDip());
721 return size; 722 return size;
722 } 723 }
723 724
724 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { 725 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const {
725 JNIEnv* env = AttachCurrentThread(); 726 JNIEnv* env = AttachCurrentThread();
726 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 727 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
727 if (j_obj.is_null()) 728 if (j_obj.is_null())
728 return gfx::Size(); 729 return gfx::Size();
729 return gfx::Size( 730 return gfx::Size(
730 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), 731 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()),
731 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); 732 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj()));
732 } 733 }
733 734
734 gfx::Size ContentViewCoreImpl::GetViewportSizePix() const { 735 gfx::Size ContentViewCoreImpl::GetViewportSizePix() const {
735 JNIEnv* env = AttachCurrentThread(); 736 JNIEnv* env = AttachCurrentThread();
736 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 737 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
737 if (j_obj.is_null()) 738 if (j_obj.is_null())
738 return gfx::Size(); 739 return gfx::Size();
739 return gfx::Size( 740 return gfx::Size(
740 Java_ContentViewCore_getViewportWidthPix(env, j_obj.obj()), 741 Java_ContentViewCore_getViewportWidthPix(env, j_obj.obj()),
741 Java_ContentViewCore_getViewportHeightPix(env, j_obj.obj())); 742 Java_ContentViewCore_getViewportHeightPix(env, j_obj.obj()));
742 } 743 }
743 744
744 int ContentViewCoreImpl::GetTopControlsLayoutHeightPix() const { 745 int ContentViewCoreImpl::GetTopControlsHeightPix() const {
745 JNIEnv* env = AttachCurrentThread(); 746 JNIEnv* env = AttachCurrentThread();
746 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 747 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
747 if (j_obj.is_null()) 748 if (j_obj.is_null())
748 return 0; 749 return 0;
749 return Java_ContentViewCore_getTopControlsLayoutHeightPix(env, j_obj.obj()); 750 return Java_ContentViewCore_getTopControlsHeightPix(env, j_obj.obj());
750 } 751 }
751 752
752 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { 753 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const {
753 return gfx::ToCeiledSize( 754 return gfx::ToCeiledSize(
754 gfx::ScaleSize(GetViewportSizePix(), 1.0f / dpi_scale())); 755 gfx::ScaleSize(GetViewportSizePix(), 1.0f / dpi_scale()));
755 } 756 }
756 757
757 float ContentViewCoreImpl::GetTopControlsLayoutHeightDip() const { 758 bool ContentViewCoreImpl::GetTopControlsShrinkBlinkSize() const {
758 return GetTopControlsLayoutHeightPix() / dpi_scale(); 759 JNIEnv* env = AttachCurrentThread();
760 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
761 if (j_obj.is_null())
762 return 0;
Ted C 2014/11/26 00:38:25 return false
763 return Java_ContentViewCore_getTopControlsShrinkBlinkSize(env, j_obj.obj());
764 }
765
766 float ContentViewCoreImpl::GetTopControlsHeightDip() const {
767 return GetTopControlsHeightPix() / dpi_scale();
759 } 768 }
760 769
761 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { 770 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) {
762 root_layer_->InsertChild(layer, 0); 771 root_layer_->InsertChild(layer, 0);
763 root_layer_->SetIsDrawable(false); 772 root_layer_->SetIsDrawable(false);
764 } 773 }
765 774
766 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) { 775 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) {
767 layer->RemoveFromParent(); 776 layer->RemoveFromParent();
768 777
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 reinterpret_cast<ui::WindowAndroid*>(window_android), 1348 reinterpret_cast<ui::WindowAndroid*>(window_android),
1340 retained_objects_set); 1349 retained_objects_set);
1341 return reinterpret_cast<intptr_t>(view); 1350 return reinterpret_cast<intptr_t>(view);
1342 } 1351 }
1343 1352
1344 bool RegisterContentViewCore(JNIEnv* env) { 1353 bool RegisterContentViewCore(JNIEnv* env) {
1345 return RegisterNativesImpl(env); 1354 return RegisterNativesImpl(env);
1346 } 1355 }
1347 1356
1348 } // namespace content 1357 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698