| Index: content/renderer/render_frame_impl.cc
|
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
| index 1866bb8b33105056a6b1fbb2698d9010aef8f515..5d0db79c338d94d456d1b2a2c373b9faf2c3d469 100644
|
| --- a/content/renderer/render_frame_impl.cc
|
| +++ b/content/renderer/render_frame_impl.cc
|
| @@ -103,6 +103,7 @@
|
| #include "third_party/WebKit/public/web/WebSearchableFormData.h"
|
| #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
|
| #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
| +#include "third_party/WebKit/public/web/WebSurroundingText.h"
|
| #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
| #include "webkit/child/weburlresponse_extradata_impl.h"
|
| @@ -722,10 +723,12 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
|
| OnSetCompositionFromExistingText)
|
| IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete,
|
| OnExtendSelectionAndDelete)
|
| + IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload)
|
| + IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest,
|
| + OnTextSurroundingSelectionRequest)
|
| #if defined(OS_MACOSX)
|
| IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard)
|
| #endif
|
| - IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload)
|
| IPC_END_MESSAGE_MAP()
|
|
|
| return handled;
|
| @@ -1204,11 +1207,29 @@ void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) {
|
| frame_->extendSelectionAndDelete(before, after);
|
| }
|
|
|
| -
|
| void RenderFrameImpl::OnReload(bool ignore_cache) {
|
| frame_->reload(ignore_cache);
|
| }
|
|
|
| +void RenderFrameImpl::OnTextSurroundingSelectionRequest(int max_length) {
|
| + blink::WebSurroundingText surroundingText;
|
| + surroundingText.initialize(frame_->selectionRange(), max_length);
|
| +
|
| + if (surroundingText.isNull()) {
|
| + // |surroundingText| might not be correctly initialized in some edge cases,
|
| + // we shouldn't call any method in that case.
|
| + Send(new FrameHostMsg_TextSurroundingSelectionResponse(
|
| + routing_id_, "", 0, 0,);
|
| + return;
|
| + }
|
| +
|
| + Send(new FrameHostMsg_TextSurroundingSelectionResponse(
|
| + routing_id_,
|
| + surroundingText.textContent(),
|
| + surroundingText.startOffsetInTextContent(),
|
| + surroundingText.endOffsetInTextContent()));
|
| +}
|
| +
|
| bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams(
|
| const base::string16& selection_text,
|
| size_t selection_text_offset,
|
|
|