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

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

Issue 292113008: Plumbing for browser process to access text surrounding selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@adb_install_humans
Patch Set: Created 6 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 8fcfba9c40c3e94337dd1e6f9ef5e67855fc275c..d1cd32b3ff98c19326c9cb2684198d032aaf61de 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -37,6 +37,7 @@
#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/ssl/ssl_host_state.h"
#include "content/browser/web_contents/web_contents_view_android.h"
+#include "content/common/frame_messages.h"
#include "content/common/input/web_input_event_traits.h"
#include "content/common/input_messages.h"
#include "content/common/view_messages.h"
@@ -1571,6 +1572,20 @@ void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) {
}
}
+void ContentViewCoreImpl::OnTextSurroundingSelectionResponse(
+ const base::string16& content,
+ unsigned start_offset,
+ unsigned end_offset) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
+ if (obj.is_null())
+ return;
+
+ ScopedJavaLocalRef<jstring> jcontent = ConvertUTF16ToJavaString(env, content);
+ Java_ContentViewCore_onTextSurroundingSelectionResponse(
+ env, obj.obj(), jcontent.obj(), start_offset, end_offset);
+}
+
void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
if (rwhv)
@@ -1631,6 +1646,14 @@ jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) {
web_contents_->GetRenderViewHost());
}
+void ContentViewCoreImpl::TextSurroundingSelectionRequest(
+ JNIEnv*, jobject, jint max_length) {
+ RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame();
+
+ focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest(
+ focused_frame->GetRoutingID(), max_length));
+}
+
void ContentViewCoreImpl::OnSmartClipDataExtracted(
const base::string16& result) {
JNIEnv* env = AttachCurrentThread();

Powered by Google App Engine
This is Rietveld 408576698