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