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

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

Issue 2300463002: Add observers for DIP scale change. (Closed)
Patch Set: Addressed comments, more questions. Created 4 years, 3 months 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 <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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 WebContents* ContentViewCoreImpl::GetWebContents() const { 877 WebContents* ContentViewCoreImpl::GetWebContents() const {
878 return web_contents_; 878 return web_contents_;
879 } 879 }
880 880
881 void ContentViewCoreImpl::SetFocus(JNIEnv* env, 881 void ContentViewCoreImpl::SetFocus(JNIEnv* env,
882 const JavaParamRef<jobject>& obj, 882 const JavaParamRef<jobject>& obj,
883 jboolean focused) { 883 jboolean focused) {
884 SetFocusInternal(focused); 884 SetFocusInternal(focused);
885 } 885 }
886 886
887 void ContentViewCoreImpl::SetDIPScale(JNIEnv* env,
888 const JavaParamRef<jobject>& obj,
889 jfloat dipScale) {
890 dpi_scale_ = dipScale;
891
892 // Force new layout.
893 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
894 if (view)
895 view->WasResized();
boliu 2016/09/15 05:27:41 don't duplicate code, factor out the current CVCI:
Tima Vaisburd 2016/09/16 23:59:26 Done.
896 }
897
887 void ContentViewCoreImpl::SetFocusInternal(bool focused) { 898 void ContentViewCoreImpl::SetFocusInternal(bool focused) {
888 if (!GetRenderWidgetHostViewAndroid()) 899 if (!GetRenderWidgetHostViewAndroid())
889 return; 900 return;
890 901
891 if (focused) 902 if (focused)
892 GetRenderWidgetHostViewAndroid()->Focus(); 903 GetRenderWidgetHostViewAndroid()->Focus();
893 else 904 else
894 GetRenderWidgetHostViewAndroid()->Blur(); 905 GetRenderWidgetHostViewAndroid()->Blur();
895 } 906 }
896 907
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 return ScopedJavaLocalRef<jobject>(); 1613 return ScopedJavaLocalRef<jobject>();
1603 1614
1604 return view->GetJavaObject(); 1615 return view->GetJavaObject();
1605 } 1616 }
1606 1617
1607 bool RegisterContentViewCore(JNIEnv* env) { 1618 bool RegisterContentViewCore(JNIEnv* env) {
1608 return RegisterNativesImpl(env); 1619 return RegisterNativesImpl(env);
1609 } 1620 }
1610 1621
1611 } // namespace content 1622 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698