| Index: content/browser/web_contents/web_contents_impl.cc
|
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
| index c7b7dda2d424a417391a9e036c5cd29ae27d8e8b..5b83ddf6372785ca51e443ff9dddeb53f0264e0a 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -39,6 +39,7 @@
|
| #include "content/browser/download/download_stats.h"
|
| #include "content/browser/download/mhtml_generation_manager.h"
|
| #include "content/browser/download/save_package.h"
|
| +#include "content/browser/find_request_manager.h"
|
| #include "content/browser/frame_host/cross_process_frame_connector.h"
|
| #include "content/browser/frame_host/interstitial_page_impl.h"
|
| #include "content/browser/frame_host/navigation_entry_impl.h"
|
| @@ -602,7 +603,6 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
|
| IPC_MESSAGE_HANDLER(FrameHostMsg_EndColorChooser, OnEndColorChooser)
|
| IPC_MESSAGE_HANDLER(FrameHostMsg_SetSelectedColorInColorChooser,
|
| OnSetSelectedColorInColorChooser)
|
| -
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint,
|
| OnFirstVisuallyNonEmptyPaint)
|
| IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache,
|
| @@ -2952,22 +2952,24 @@ void WebContentsImpl::Find(int request_id,
|
| }
|
|
|
| // See if a top level browser plugin handles the find request first.
|
| + // TODO(paulmeyer): Remove this after find-in-page works across GuestViews.
|
| if (browser_plugin_embedder_ &&
|
| browser_plugin_embedder_->Find(request_id, search_text, options)) {
|
| return;
|
| }
|
| - GetMainFrame()->Send(new FrameMsg_Find(GetMainFrame()->GetRoutingID(),
|
| - request_id, search_text, options));
|
| +
|
| + GetOrCreateFindRequestManager()->Find(request_id, search_text, options);
|
| }
|
|
|
| void WebContentsImpl::StopFinding(StopFindAction action) {
|
| // See if a top level browser plugin handles the stop finding request first.
|
| + // TODO(paulmeyer): Remove this after find-in-page works across GuestViews.
|
| if (browser_plugin_embedder_ &&
|
| browser_plugin_embedder_->StopFinding(action)) {
|
| return;
|
| }
|
| - GetMainFrame()->Send(
|
| - new FrameMsg_StopFinding(GetMainFrame()->GetRoutingID(), action));
|
| +
|
| + GetOrCreateFindRequestManager()->StopFinding(action);
|
| }
|
|
|
| void WebContentsImpl::InsertCSS(const std::string& css) {
|
| @@ -3485,10 +3487,14 @@ void WebContentsImpl::OnFindReply(int request_id,
|
| const gfx::Rect& selection_rect,
|
| int active_match_ordinal,
|
| bool final_update) {
|
| - if (delegate_) {
|
| - delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
|
| - active_match_ordinal, final_update);
|
| - }
|
| + // Forward the find reply to the FindRequestManager, along with the
|
| + // RenderFrameHost associated with the frame that the reply came from.
|
| + GetOrCreateFindRequestManager()->OnFindReply(render_frame_message_source_,
|
| + request_id,
|
| + number_of_matches,
|
| + selection_rect,
|
| + active_match_ordinal,
|
| + final_update);
|
| }
|
|
|
| #if defined(OS_ANDROID)
|
| @@ -3496,8 +3502,8 @@ void WebContentsImpl::OnFindMatchRectsReply(
|
| int version,
|
| const std::vector<gfx::RectF>& rects,
|
| const gfx::RectF& active_rect) {
|
| - if (delegate_)
|
| - delegate_->FindMatchRectsReply(this, version, rects, active_rect);
|
| + GetOrCreateFindRequestManager()->OnFindMatchRectsReply(
|
| + render_frame_message_source_, version, rects, active_rect);
|
| }
|
|
|
| void WebContentsImpl::OnOpenDateTimeDialog(
|
| @@ -4699,6 +4705,15 @@ WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() {
|
| return web_contents_android;
|
| }
|
|
|
| +void WebContentsImpl::ActivateNearestFindResult(float x,
|
| + float y) {
|
| + GetOrCreateFindRequestManager()->ActivateNearestFindResult(x, y);
|
| +}
|
| +
|
| +void WebContentsImpl::RequestFindMatchRects(int current_version) {
|
| + GetOrCreateFindRequestManager()->RequestFindMatchRects(current_version);
|
| +}
|
| +
|
| bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() {
|
| return CreateRenderViewForRenderManager(
|
| GetRenderViewHost(), MSG_ROUTING_NONE, MSG_ROUTING_NONE,
|
| @@ -4855,6 +4870,37 @@ WebUI* WebContentsImpl::CreateWebUI(const GURL& url,
|
| return NULL;
|
| }
|
|
|
| +FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() {
|
| + // TODO(paulmeyer): This method will need to access (or potentially create)
|
| + // the FindRequestManager in the outermost WebContents once find-in-page
|
| + // across GuestViews is implemented.
|
| + if (!find_request_manager_)
|
| + find_request_manager_.reset(new FindRequestManager(this));
|
| +
|
| + return find_request_manager_.get();
|
| +}
|
| +
|
| +void WebContentsImpl::NotifyFindReply(int request_id,
|
| + int number_of_matches,
|
| + const gfx::Rect& selection_rect,
|
| + int active_match_ordinal,
|
| + bool final_update) {
|
| + if (delegate_) {
|
| + delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
|
| + active_match_ordinal, final_update);
|
| + }
|
| +}
|
| +
|
| +#if defined(OS_ANDROID)
|
| +void WebContentsImpl::NotifyFindMatchRectsReply(
|
| + int version,
|
| + const std::vector<gfx::RectF>& rects,
|
| + const gfx::RectF& active_rect) {
|
| + if (delegate_)
|
| + delegate_->FindMatchRectsReply(this, version, rects, active_rect);
|
| +}
|
| +#endif
|
| +
|
| void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
|
| force_disable_overscroll_content_ = force_disable;
|
| if (view_)
|
|
|