Chromium Code Reviews| 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 |
|
no sievers
2015/10/22 20:55:40
revert changes to this file
mfomitchev
2015/11/02 21:51:15
Done.
| |
| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 WebContents* web_contents, | 205 WebContents* web_contents, |
| 206 jobject view_android_delegate, | 206 jobject view_android_delegate, |
| 207 ui::WindowAndroid* window_android, | 207 ui::WindowAndroid* window_android, |
| 208 jobject java_bridge_retained_object_set) | 208 jobject java_bridge_retained_object_set) |
| 209 : WebContentsObserver(web_contents), | 209 : WebContentsObserver(web_contents), |
| 210 java_ref_(env, obj), | 210 java_ref_(env, obj), |
| 211 web_contents_(static_cast<WebContentsImpl*>(web_contents)), | 211 web_contents_(static_cast<WebContentsImpl*>(web_contents)), |
| 212 root_layer_(cc::SolidColorLayer::Create(Compositor::LayerSettings())), | 212 root_layer_(cc::SolidColorLayer::Create(Compositor::LayerSettings())), |
| 213 page_scale_(1), | 213 page_scale_(1), |
| 214 view_android_(new ui::ViewAndroid(view_android_delegate, window_android)), | 214 view_android_(new ui::ViewAndroid(view_android_delegate, window_android)), |
| 215 dpi_scale_(ui::GetScaleFactorForNativeView(view_android_.get())), | 215 dpi_scale_(1), |
| 216 window_android_(window_android), | 216 window_android_(window_android), |
| 217 device_orientation_(0), | 217 device_orientation_(0), |
| 218 accessibility_enabled_(false) { | 218 accessibility_enabled_(false) { |
| 219 CHECK(web_contents) << | 219 CHECK(web_contents) << |
| 220 "A ContentViewCoreImpl should be created with a valid WebContents."; | 220 "A ContentViewCoreImpl should be created with a valid WebContents."; |
| 221 DCHECK(window_android_); | 221 DCHECK(window_android_); |
| 222 | 222 |
| 223 root_layer_->SetBackgroundColor(GetBackgroundColor(env, obj)); | 223 root_layer_->SetBackgroundColor(GetBackgroundColor(env, obj)); |
| 224 gfx::Size physical_size( | 224 gfx::Size physical_size( |
| 225 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), | 225 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1288 } else { | 1288 } else { |
| 1289 accessibility_state->ResetAccessibilityMode(); | 1289 accessibility_state->ResetAccessibilityMode(); |
| 1290 if (web_contents_) { | 1290 if (web_contents_) { |
| 1291 web_contents_->SetAccessibilityMode( | 1291 web_contents_->SetAccessibilityMode( |
| 1292 accessibility_state->accessibility_mode()); | 1292 accessibility_state->accessibility_mode()); |
| 1293 } | 1293 } |
| 1294 } | 1294 } |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1297 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
| 1298 #if !defined(USE_AURA) | |
| 1298 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1299 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1299 if (rwhv) | 1300 if (rwhv) |
| 1300 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1301 rwhv->UpdateScreenInfo(GetViewAndroid()); |
| 1302 #endif | |
| 1301 | 1303 |
| 1302 static_cast<WebContentsImpl*>(web_contents())-> | 1304 static_cast<WebContentsImpl*>(web_contents())-> |
| 1303 screen_orientation_dispatcher_host()->OnOrientationChange(); | 1305 screen_orientation_dispatcher_host()->OnOrientationChange(); |
| 1304 } | 1306 } |
| 1305 | 1307 |
| 1306 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, | 1308 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, |
| 1307 jobject obj, | 1309 jobject obj, |
| 1308 jint x, | 1310 jint x, |
| 1309 jint y, | 1311 jint y, |
| 1310 jint width, | 1312 jint width, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1447 return ScopedJavaLocalRef<jobject>(); | 1449 return ScopedJavaLocalRef<jobject>(); |
| 1448 | 1450 |
| 1449 return view->GetJavaObject(); | 1451 return view->GetJavaObject(); |
| 1450 } | 1452 } |
| 1451 | 1453 |
| 1452 bool RegisterContentViewCore(JNIEnv* env) { | 1454 bool RegisterContentViewCore(JNIEnv* env) { |
| 1453 return RegisterNativesImpl(env); | 1455 return RegisterNativesImpl(env); |
| 1454 } | 1456 } |
| 1455 | 1457 |
| 1456 } // namespace content | 1458 } // namespace content |
| OLD | NEW |