Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 2103243002: Factor out ContentViewAndroidDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 7d636b6f9cd372551f017f41d54572848b612c65..8cb7f905686760d6e15fdadbd75b75de0c18a0e0 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -499,8 +499,6 @@ void ContentViewCoreImpl::ShowSelectPopupMenu(
if (j_obj.is_null())
return;
- ScopedJavaLocalRef<jobject> bounds_rect(CreateJavaRect(env, bounds));
-
// For multi-select list popups we find the list of previous selections by
// iterating through the items. But for single selection popups we take the
// given |selected_item| as is.
@@ -537,12 +535,29 @@ void ContentViewCoreImpl::ShowSelectPopupMenu(
}
ScopedJavaLocalRef<jobjectArray> items_array(
base::android::ToJavaArrayOfStrings(env, labels));
+ ScopedJavaLocalRef<jobject> anchor_view = AcquireAnchorView(
+ gfx::RectF(bounds.x() * page_scale_,
+ bounds.y() * page_scale_,
+ bounds.width() * page_scale_,
+ bounds.height() * page_scale_));
Java_ContentViewCore_showSelectPopup(
- env, j_obj.obj(), reinterpret_cast<intptr_t>(frame), bounds_rect.obj(),
+ env, j_obj.obj(), anchor_view.obj(), bounds.width() * page_scale_,
+ reinterpret_cast<intptr_t>(frame),
items_array.obj(), enabled_array.obj(), multiple, selected_array.obj(),
right_aligned);
}
+ScopedJavaLocalRef<jobject>
+ContentViewCoreImpl::AcquireAnchorView(const gfx::RectF& bounds) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
+ if (j_obj.is_null())
+ return ScopedJavaLocalRef<jobject>();
+ return Java_ContentViewCore_acquireAnchorView(
+ env, j_obj.obj(), bounds.x(), bounds.y(), bounds.width(),
+ bounds.height());
+}
+
void ContentViewCoreImpl::HideSelectPopupMenu() {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);

Powered by Google App Engine
This is Rietveld 408576698