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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 | 1234 |
1235 bool ContentViewCoreImpl::IsFullscreenRequiredForOrientationLock() const { | 1235 bool ContentViewCoreImpl::IsFullscreenRequiredForOrientationLock() const { |
1236 JNIEnv* env = AttachCurrentThread(); | 1236 JNIEnv* env = AttachCurrentThread(); |
1237 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1237 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1238 if (obj.is_null()) | 1238 if (obj.is_null()) |
1239 return true; | 1239 return true; |
1240 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, | 1240 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, |
1241 obj.obj()); | 1241 obj.obj()); |
1242 } | 1242 } |
1243 | 1243 |
| 1244 gfx::Vector2d ContentViewCoreImpl::GetLocationOnScreen() const { |
| 1245 JNIEnv* env = AttachCurrentThread(); |
| 1246 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1247 if (obj.is_null()) |
| 1248 return gfx::Vector2d(); |
| 1249 const uint64 combined_coordinates = static_cast<uint64>( |
| 1250 Java_ContentViewCore_getLocationOnScreen(env, obj.obj())); |
| 1251 const uint32 high_dword = static_cast<uint32>(combined_coordinates >> 32); |
| 1252 const uint32 low_dword = static_cast<uint32>(combined_coordinates); |
| 1253 return gfx::Vector2d(static_cast<int32>(high_dword), |
| 1254 static_cast<int32>(low_dword)); |
| 1255 } |
| 1256 |
1244 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { | 1257 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { |
1245 accessibility_enabled_ = enabled; | 1258 accessibility_enabled_ = enabled; |
1246 BrowserAccessibilityStateImpl* accessibility_state = | 1259 BrowserAccessibilityStateImpl* accessibility_state = |
1247 BrowserAccessibilityStateImpl::GetInstance(); | 1260 BrowserAccessibilityStateImpl::GetInstance(); |
1248 if (enabled) { | 1261 if (enabled) { |
1249 // This enables accessibility globally unless it was explicitly disallowed | 1262 // This enables accessibility globally unless it was explicitly disallowed |
1250 // by a command-line flag. | 1263 // by a command-line flag. |
1251 accessibility_state->OnScreenReaderDetected(); | 1264 accessibility_state->OnScreenReaderDetected(); |
1252 // If it was actually enabled globally, enable it for this RenderWidget now. | 1265 // If it was actually enabled globally, enable it for this RenderWidget now. |
1253 if (accessibility_state->IsAccessibleBrowser() && web_contents_) | 1266 if (accessibility_state->IsAccessibleBrowser() && web_contents_) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1368 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1356 retained_objects_set); | 1369 retained_objects_set); |
1357 return reinterpret_cast<intptr_t>(view); | 1370 return reinterpret_cast<intptr_t>(view); |
1358 } | 1371 } |
1359 | 1372 |
1360 bool RegisterContentViewCore(JNIEnv* env) { | 1373 bool RegisterContentViewCore(JNIEnv* env) { |
1361 return RegisterNativesImpl(env); | 1374 return RegisterNativesImpl(env); |
1362 } | 1375 } |
1363 | 1376 |
1364 } // namespace content | 1377 } // namespace content |
OLD | NEW |