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

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

Issue 2785853002: Selection Action mode triggered like a context menu (Closed)
Patch Set: fix rebase Created 3 years, 7 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 27f8fa237631ec95f4f57abe77a41c4872042835..bc68d1897a740f9736db19f3b90ad314eab719c3 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -75,6 +75,7 @@ using base::android::JavaRef;
using base::android::ScopedJavaLocalRef;
using blink::WebContextMenuData;
using blink::WebGestureEvent;
+using blink::WebContextMenuData;
using blink::WebInputEvent;
namespace content {
@@ -573,9 +574,13 @@ void ContentViewCoreImpl::RequestDisallowInterceptTouchEvent() {
Java_ContentViewCore_requestDisallowInterceptTouchEvent(env, obj);
}
-bool ContentViewCoreImpl::ShowPastePopup(const ContextMenuParams& params) {
+bool ContentViewCoreImpl::ShowSelectionMenu(const ContextMenuParams& params) {
// Display paste pop-up only when selection is empty and editable.
- if (!(params.is_editable && params.selection_text.empty()))
+ const bool from_touch = params.source_type == ui::MENU_SOURCE_TOUCH ||
+ params.source_type == ui::MENU_SOURCE_LONG_PRESS ||
+ params.source_type == ui::MENU_SOURCE_TOUCH_HANDLE ||
+ params.source_type == ui::MENU_SOURCE_STYLUS;
+ if (!from_touch || (!params.is_editable && params.selection_text.empty()))
return false;
RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
@@ -591,13 +596,21 @@ bool ContentViewCoreImpl::ShowPastePopup(const ContextMenuParams& params) {
!!(params.edit_flags & WebContextMenuData::kCanSelectAll);
const bool can_edit_richly =
!!(params.edit_flags & blink::WebContextMenuData::kCanEditRichly);
-
int handle_height = GetRenderWidgetHostViewAndroid()->GetTouchHandleHeight();
- Java_ContentViewCore_showPastePopup(
+ const bool is_password_type =
+ params.input_field_type ==
+ blink::WebContextMenuData::kInputFieldTypePassword;
+ const ScopedJavaLocalRef<jstring> jselected_text =
+ ConvertUTF16ToJavaString(env, params.selection_text);
+ const bool should_suggest = params.source_type == ui::MENU_SOURCE_TOUCH ||
+ params.source_type == ui::MENU_SOURCE_LONG_PRESS;
+
+ Java_ContentViewCore_showSelectionMenu(
env, obj, params.selection_rect.x(), params.selection_rect.y(),
params.selection_rect.right(),
- params.selection_rect.bottom() + handle_height, can_select_all,
- can_edit_richly);
+ params.selection_rect.bottom() + handle_height, params.is_editable,
+ is_password_type, jselected_text, can_select_all, can_edit_richly,
+ should_suggest);
return true;
}
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/input/stylus_text_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698