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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 WebContents* web_contents, | 210 WebContents* web_contents, |
211 jobject view_android_delegate, | 211 jobject view_android_delegate, |
212 ui::WindowAndroid* window_android, | 212 ui::WindowAndroid* window_android, |
213 jobject java_bridge_retained_object_set) | 213 jobject java_bridge_retained_object_set) |
214 : WebContentsObserver(web_contents), | 214 : WebContentsObserver(web_contents), |
215 java_ref_(env, obj), | 215 java_ref_(env, obj), |
216 web_contents_(static_cast<WebContentsImpl*>(web_contents)), | 216 web_contents_(static_cast<WebContentsImpl*>(web_contents)), |
217 root_layer_(cc::SolidColorLayer::Create(Compositor::LayerSettings())), | 217 root_layer_(cc::SolidColorLayer::Create(Compositor::LayerSettings())), |
218 page_scale_(1), | 218 page_scale_(1), |
219 view_android_(new ui::ViewAndroid(view_android_delegate, window_android)), | 219 view_android_(new ui::ViewAndroid(view_android_delegate, window_android)), |
220 dpi_scale_(ui::GetScaleFactorForNativeView(view_android_.get())), | 220 dpi_scale_(1), |
221 window_android_(window_android), | 221 window_android_(window_android), |
222 device_orientation_(0), | 222 device_orientation_(0), |
223 accessibility_enabled_(false) { | 223 accessibility_enabled_(false) { |
224 CHECK(web_contents) << | 224 CHECK(web_contents) << |
225 "A ContentViewCoreImpl should be created with a valid WebContents."; | 225 "A ContentViewCoreImpl should be created with a valid WebContents."; |
226 DCHECK(window_android_); | 226 DCHECK(window_android_); |
227 | 227 |
228 root_layer_->SetBackgroundColor(GetBackgroundColor(env, obj)); | 228 root_layer_->SetBackgroundColor(GetBackgroundColor(env, obj)); |
229 gfx::Size physical_size( | 229 gfx::Size physical_size( |
230 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), | 230 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 } else { | 1317 } else { |
1318 accessibility_state->ResetAccessibilityMode(); | 1318 accessibility_state->ResetAccessibilityMode(); |
1319 if (web_contents_) { | 1319 if (web_contents_) { |
1320 web_contents_->SetAccessibilityMode( | 1320 web_contents_->SetAccessibilityMode( |
1321 accessibility_state->accessibility_mode()); | 1321 accessibility_state->accessibility_mode()); |
1322 } | 1322 } |
1323 } | 1323 } |
1324 } | 1324 } |
1325 | 1325 |
1326 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1326 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
| 1327 #if !defined(USE_AURA) |
1327 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1328 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1328 if (rwhv) | 1329 if (rwhv) |
1329 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1330 rwhv->UpdateScreenInfo(GetViewAndroid()); |
| 1331 #endif |
1330 | 1332 |
1331 static_cast<WebContentsImpl*>(web_contents())-> | 1333 static_cast<WebContentsImpl*>(web_contents())-> |
1332 screen_orientation_dispatcher_host()->OnOrientationChange(); | 1334 screen_orientation_dispatcher_host()->OnOrientationChange(); |
1333 } | 1335 } |
1334 | 1336 |
1335 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, | 1337 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, |
1336 jobject obj, | 1338 jobject obj, |
1337 jint x, | 1339 jint x, |
1338 jint y, | 1340 jint y, |
1339 jint width, | 1341 jint width, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 return NULL; | 1478 return NULL; |
1477 | 1479 |
1478 return view->GetJavaObject().Release(); | 1480 return view->GetJavaObject().Release(); |
1479 } | 1481 } |
1480 | 1482 |
1481 bool RegisterContentViewCore(JNIEnv* env) { | 1483 bool RegisterContentViewCore(JNIEnv* env) { |
1482 return RegisterNativesImpl(env); | 1484 return RegisterNativesImpl(env); |
1483 } | 1485 } |
1484 | 1486 |
1485 } // namespace content | 1487 } // namespace content |
OLD | NEW |