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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2157793002: Remove ContentViewCore::RequestTextSurroundingSelection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/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() {

Powered by Google App Engine
This is Rietveld 408576698