Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index f740291f25fc9e02c4696e9d8e8d5d359bd86b99..f4cc2e2b4e3ceb969645c8af7fa4fe18bb00655a 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -21,6 +21,7 @@ |
#include "base/android/jni_android.h" |
#include "base/android/jni_array.h" |
#include "base/android/jni_string.h" |
+#include "base/android/scoped_java_ref.h" |
#include "base/bind.h" |
#include "base/callback.h" |
#include "base/message_loop.h" |
@@ -672,6 +673,18 @@ jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) { |
return reinterpret_cast<jint>(pending_contents_.release()); |
} |
+gfx::Point AwContents::GetLocationOnScreen() { |
+ JNIEnv* env = AttachCurrentThread(); |
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
+ if (obj.is_null()) return gfx::Point(); |
+ std::vector<int> location; |
+ base::android::JavaIntArrayToIntVector( |
+ env, |
+ Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), |
+ &location); |
+ return gfx::Point(location[0], location[1]); |
+} |
+ |
ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, |
jobject obj) { |
return browser_view_renderer_->CapturePicture(); |