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

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

Issue 322203002: Add an interface to gather text surrounding the selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@surroundings-patch-5
Patch Set: 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 2f0322f30311b79dae940d09a35013bce3206172..99acd4af35687d97ca043a717e3cd2c3ff007372 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -1539,14 +1539,10 @@ 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(
- env, obj.obj(), jcontent.obj(), start_offset, end_offset);
+ if (text_surroundings_delegate_ != NULL) {
+ text_surroundings_delegate_->OnTextSurroundingSelectionResponse(
+ content, start_offset, end_offset);
+ }
}
void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
@@ -1615,8 +1611,7 @@ void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj,
GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque);
}
-void ContentViewCoreImpl::TextSurroundingSelectionRequest(
- JNIEnv*, jobject, jint max_length) {
+void ContentViewCoreImpl::TextSurroundingSelectionRequest(int max_length) {
RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame();
focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest(

Powered by Google App Engine
This is Rietveld 408576698