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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 jobject obj, | 207 jobject obj, |
208 WebContents* web_contents, | 208 WebContents* web_contents, |
209 jobject view_android_delegate, | 209 jobject view_android_delegate, |
210 ui::WindowAndroid* window_android, | 210 ui::WindowAndroid* window_android, |
211 jobject java_bridge_retained_object_set) | 211 jobject java_bridge_retained_object_set) |
212 : WebContentsObserver(web_contents), | 212 : WebContentsObserver(web_contents), |
213 java_ref_(env, obj), | 213 java_ref_(env, obj), |
214 web_contents_(static_cast<WebContentsImpl*>(web_contents)), | 214 web_contents_(static_cast<WebContentsImpl*>(web_contents)), |
215 root_layer_(cc::SolidColorLayer::Create(Compositor::LayerSettings())), | 215 root_layer_(cc::SolidColorLayer::Create(Compositor::LayerSettings())), |
216 page_scale_(1), | 216 page_scale_(1), |
| 217 window_android_(window_android), |
| 218 // window_android_ must be initialized before calling |
| 219 // GetScaleFactorForNativeView since this method uses window_android_ |
217 dpi_scale_(ui::GetScaleFactorForNativeView(this)), | 220 dpi_scale_(ui::GetScaleFactorForNativeView(this)), |
218 window_android_(window_android), | |
219 device_orientation_(0), | 221 device_orientation_(0), |
220 accessibility_enabled_(false) { | 222 accessibility_enabled_(false) { |
221 CHECK(web_contents) << | 223 CHECK(web_contents) << |
222 "A ContentViewCoreImpl should be created with a valid WebContents."; | 224 "A ContentViewCoreImpl should be created with a valid WebContents."; |
223 DCHECK(window_android_); | 225 DCHECK(window_android_); |
224 DCHECK(view_android_delegate); | 226 DCHECK(view_android_delegate); |
225 view_android_delegate_.Reset(AttachCurrentThread(), view_android_delegate); | 227 view_android_delegate_.Reset(AttachCurrentThread(), view_android_delegate); |
226 root_layer_->SetBackgroundColor(GetBackgroundColor(env, obj)); | 228 root_layer_->SetBackgroundColor(GetBackgroundColor(env, obj)); |
227 gfx::Size physical_size( | 229 gfx::Size physical_size( |
228 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), | 230 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 return ScopedJavaLocalRef<jobject>(); | 1523 return ScopedJavaLocalRef<jobject>(); |
1522 | 1524 |
1523 return view->GetJavaObject(); | 1525 return view->GetJavaObject(); |
1524 } | 1526 } |
1525 | 1527 |
1526 bool RegisterContentViewCore(JNIEnv* env) { | 1528 bool RegisterContentViewCore(JNIEnv* env) { |
1527 return RegisterNativesImpl(env); | 1529 return RegisterNativesImpl(env); |
1528 } | 1530 } |
1529 | 1531 |
1530 } // namespace content | 1532 } // namespace content |
OLD | NEW |