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

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: rebase - use int Created 6 years, 6 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 8fdfb8c27fc22a55f2f07009d3d08203e02b8e8a..2f0322f30311b79dae940d09a35013bce3206172 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"
@@ -1534,6 +1535,20 @@ void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) {
}
}
+void ContentViewCoreImpl::OnTextSurroundingSelectionResponse(
+ const base::string16& content,
+ int start_offset,
+ int 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(
jdduke (slow) 2014/06/06 01:28:31 I believe Donn is exploring ways to route the stri
+ env, obj.obj(), jcontent.obj(), start_offset, end_offset);
+}
+
void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
if (rwhv)
@@ -1600,6 +1615,14 @@ void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj,
GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque);
}
+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();
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698