| 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 | 1235 |
| 1236 bool ContentViewCoreImpl::IsFullscreenRequiredForOrientationLock() const { | 1236 bool ContentViewCoreImpl::IsFullscreenRequiredForOrientationLock() const { |
| 1237 JNIEnv* env = AttachCurrentThread(); | 1237 JNIEnv* env = AttachCurrentThread(); |
| 1238 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1238 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1239 if (obj.is_null()) | 1239 if (obj.is_null()) |
| 1240 return true; | 1240 return true; |
| 1241 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, | 1241 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, |
| 1242 obj.obj()); | 1242 obj.obj()); |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 gfx::Vector2d ContentViewCoreImpl::GetLocationOnScreen() const { |
| 1246 JNIEnv* env = AttachCurrentThread(); |
| 1247 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1248 if (obj.is_null()) |
| 1249 return gfx::Vector2d(); |
| 1250 const uint64 combined_coordinates = static_cast<uint64>( |
| 1251 Java_ContentViewCore_getLocationOnScreen(env, obj.obj())); |
| 1252 const uint32 high_dword = static_cast<uint32>(combined_coordinates >> 32); |
| 1253 const uint32 low_dword = static_cast<uint32>(combined_coordinates); |
| 1254 return gfx::Vector2d(static_cast<int32>(high_dword), |
| 1255 static_cast<int32>(low_dword)); |
| 1256 } |
| 1257 |
| 1245 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { | 1258 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { |
| 1246 accessibility_enabled_ = enabled; | 1259 accessibility_enabled_ = enabled; |
| 1247 BrowserAccessibilityStateImpl* accessibility_state = | 1260 BrowserAccessibilityStateImpl* accessibility_state = |
| 1248 BrowserAccessibilityStateImpl::GetInstance(); | 1261 BrowserAccessibilityStateImpl::GetInstance(); |
| 1249 if (enabled) { | 1262 if (enabled) { |
| 1250 // This enables accessibility globally unless it was explicitly disallowed | 1263 // This enables accessibility globally unless it was explicitly disallowed |
| 1251 // by a command-line flag. | 1264 // by a command-line flag. |
| 1252 accessibility_state->OnScreenReaderDetected(); | 1265 accessibility_state->OnScreenReaderDetected(); |
| 1253 // If it was actually enabled globally, enable it for this RenderWidget now. | 1266 // If it was actually enabled globally, enable it for this RenderWidget now. |
| 1254 if (accessibility_state->IsAccessibleBrowser() && web_contents_) | 1267 if (accessibility_state->IsAccessibleBrowser() && web_contents_) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 return NULL; | 1394 return NULL; |
| 1382 | 1395 |
| 1383 return view->GetJavaObject().Release(); | 1396 return view->GetJavaObject().Release(); |
| 1384 } | 1397 } |
| 1385 | 1398 |
| 1386 bool RegisterContentViewCore(JNIEnv* env) { | 1399 bool RegisterContentViewCore(JNIEnv* env) { |
| 1387 return RegisterNativesImpl(env); | 1400 return RegisterNativesImpl(env); |
| 1388 } | 1401 } |
| 1389 | 1402 |
| 1390 } // namespace content | 1403 } // namespace content |
| OLD | NEW |