Chromium Code Reviews| 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( |
|
jdduke (slow)
2014/06/10 14:53:32
As mentioned, let's defer adding the hooks into Ja
|
| + 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); |
| +} |
| + |
| 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(); |