| Index: content/browser/frame_host/render_frame_host_impl.cc
|
| diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
|
| index fadeeca42041cb03120150ffe39978fa7c35804d..88de333f46af4421e7686a66df5213c7b4013478 100644
|
| --- a/content/browser/frame_host/render_frame_host_impl.cc
|
| +++ b/content/browser/frame_host/render_frame_host_impl.cc
|
| @@ -1562,12 +1562,30 @@ void RenderFrameHostImpl::OnRunFileChooser(const FileChooserParams& params) {
|
| delegate_->RunFileChooser(this, params);
|
| }
|
|
|
| +bool RenderFrameHostImpl::HasTextSurroundingSelectionCallback() {
|
| + return !text_surrounding_selection_callback_.is_null();
|
| +}
|
| +
|
| +void RenderFrameHostImpl::SendTextSurroundingSelectionRequest(
|
| + const TextSurroundingSelectionCallback& callback,
|
| + int max_length) {
|
| + // Only one outstanding request is allowed at any given time.
|
| + DCHECK(!callback.is_null());
|
| + text_surrounding_selection_callback_ = callback;
|
| + Send(
|
| + new FrameMsg_TextSurroundingSelectionRequest(GetRoutingID(), max_length));
|
| +}
|
| +
|
| void RenderFrameHostImpl::OnTextSurroundingSelectionResponse(
|
| const base::string16& content,
|
| uint32_t start_offset,
|
| uint32_t end_offset) {
|
| - render_view_host_->OnTextSurroundingSelectionResponse(
|
| - content, start_offset, end_offset);
|
| + // Just Run the callback instead of propagating further.
|
| +
|
| + text_surrounding_selection_callback_.Run(content, start_offset, end_offset);
|
| + // Reset the callback for enabling early exit from the caller itself using
|
| + // hasTextSurroundingSelectionCallback()
|
| + text_surrounding_selection_callback_.Reset();
|
| }
|
|
|
| void RenderFrameHostImpl::OnDidAccessInitialDocument() {
|
|
|