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 0fdc058b01df1913bdd2fd047833cf83185792e2..672389aa1490d17ea288ee0c127d91192601e27a 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" |
@@ -1538,6 +1539,17 @@ void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { |
} |
} |
+void ContentViewCoreImpl::OnTextSurroundingSelectionResponse( |
+ const base::string16& content, |
+ int start_offset, |
+ int end_offset) { |
+ if (text_surroundings_callback_.is_null()) |
+ return; |
+ text_surroundings_callback_.Run(content, start_offset, end_offset); |
+ // Re-initialize to the is_null value. |
jdduke (slow)
2014/06/18 20:32:53
In the comments what if we instead say "The callba
donnd
2014/06/18 21:55:27
Done.
|
+ text_surroundings_callback_ = TextSurroundingSelectionCallback(); |
+} |
+ |
void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
if (rwhv) |
@@ -1604,6 +1616,18 @@ void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj, |
GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque); |
} |
+void ContentViewCoreImpl::RequestTextSurroundingSelection( |
+ int max_length, const TextSurroundingSelectionCallback& callback) { |
+ RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame(); |
+ if (!focused_frame) |
+ return; |
+ if (!text_surroundings_callback_.is_null()) |
jdduke (slow)
2014/06/18 20:32:53
I'm not sure if we should be DCHECK'ing, here, but
donnd
2014/06/18 21:55:27
Glad you caught this possibility! I changed the r
|
+ return; |
+ text_surroundings_callback_ = callback; |
+ focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( |
+ focused_frame->GetRoutingID(), max_length)); |
+} |
+ |
void ContentViewCoreImpl::OnSmartClipDataExtracted( |
const base::string16& result) { |
JNIEnv* env = AttachCurrentThread(); |