| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return ContentViewCoreImpl::FromWebContents(web_contents); | 148 return ContentViewCoreImpl::FromWebContents(web_contents); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // static | 151 // static |
| 152 ContentViewCore* ContentViewCore::GetNativeContentViewCore(JNIEnv* env, | 152 ContentViewCore* ContentViewCore::GetNativeContentViewCore(JNIEnv* env, |
| 153 jobject obj) { | 153 jobject obj) { |
| 154 return reinterpret_cast<ContentViewCore*>( | 154 return reinterpret_cast<ContentViewCore*>( |
| 155 Java_ContentViewCore_getNativeContentViewCore(env, obj)); | 155 Java_ContentViewCore_getNativeContentViewCore(env, obj)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 float ContentViewCoreImpl::GetDeviceScaleFactor() const { |
| 159 JNIEnv* env = AttachCurrentThread(); |
| 160 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 161 if (obj.is_null()) |
| 162 return 1.0f; |
| 163 return Java_ContentViewCore_getDeviceScaleFactor(env, obj.obj()); |
| 164 } |
| 165 |
| 158 ContentViewCoreImpl::ContentViewCoreImpl(JNIEnv* env, jobject obj, | 166 ContentViewCoreImpl::ContentViewCoreImpl(JNIEnv* env, jobject obj, |
| 159 bool hardware_accelerated, | 167 bool hardware_accelerated, |
| 160 WebContents* web_contents, | 168 WebContents* web_contents, |
| 161 ui::ViewAndroid* view_android, | 169 ui::ViewAndroid* view_android, |
| 162 ui::WindowAndroid* window_android) | 170 ui::WindowAndroid* window_android) |
| 163 : WebContentsObserver(web_contents), | 171 : WebContentsObserver(web_contents), |
| 164 java_ref_(env, obj), | 172 java_ref_(env, obj), |
| 165 web_contents_(static_cast<WebContentsImpl*>(web_contents)), | 173 web_contents_(static_cast<WebContentsImpl*>(web_contents)), |
| 166 root_layer_(cc::Layer::Create()), | 174 root_layer_(cc::Layer::Create()), |
| 167 vsync_interval_(base::TimeDelta::FromMicroseconds( | 175 vsync_interval_(base::TimeDelta::FromMicroseconds( |
| (...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1644 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1637 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1645 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1638 return reinterpret_cast<intptr_t>(view); | 1646 return reinterpret_cast<intptr_t>(view); |
| 1639 } | 1647 } |
| 1640 | 1648 |
| 1641 bool RegisterContentViewCore(JNIEnv* env) { | 1649 bool RegisterContentViewCore(JNIEnv* env) { |
| 1642 return RegisterNativesImpl(env); | 1650 return RegisterNativesImpl(env); |
| 1643 } | 1651 } |
| 1644 | 1652 |
| 1645 } // namespace content | 1653 } // namespace content |
| OLD | NEW |