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

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

Issue 2724533002: Deduplicating code |WebContentsDelegateAndroid::ShowContextMenu()| (Closed)
Patch Set: ContextMenuParams is a struct Created 3 years, 10 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 af72e451a617ce1cbfe6d739c5faa76380ad67c7..e036fb8b1664ecae254d67f2594a5dc420a12fc7 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -628,17 +628,22 @@ void ContentViewCoreImpl::OnSelectionEvent(ui::SelectionEventType event,
selection_rect.bottom());
}
-void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) {
+bool ContentViewCoreImpl::ShowPastePopup(const ContextMenuParams& params) {
+ // Display paste pop-up only when selection is empty and editable.
+ if (!(params.is_editable && params.selection_text.empty()))
+ return false;
+
RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
if (!view)
- return;
+ return false;
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (obj.is_null())
- return;
- Java_ContentViewCore_showPastePopup(env, obj, x_dip,
- y_dip);
+ return false;
+ Java_ContentViewCore_showPastePopup(env, obj, params.selection_start.x(),
+ params.selection_start.y());
+ return true;
}
void ContentViewCoreImpl::ShowDisambiguationPopup(
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/public/browser/android/content_view_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698