Commit 36ec24fc authored by fsamuel@chromium.org's avatar fsamuel@chromium.org

Move Find Operations from RenderViewHost to WebContents

BUG=330843

Review URL: https://codereview.chromium.org/128453002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243709 0039d316-1c4b-4281-b951-d872f2087c98
parent 31a876fd
...@@ -37,8 +37,7 @@ void FindHelper::SetListener(Listener* listener) { ...@@ -37,8 +37,7 @@ void FindHelper::SetListener(Listener* listener) {
void FindHelper::FindAllAsync(const base::string16& search_string) { void FindHelper::FindAllAsync(const base::string16& search_string) {
// Stop any ongoing asynchronous request. // Stop any ongoing asynchronous request.
web_contents()->GetRenderViewHost()->StopFinding( web_contents()->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
content::STOP_FIND_ACTION_KEEP_SELECTION);
sync_find_started_ = false; sync_find_started_ = false;
async_find_started_ = true; async_find_started_ = true;
...@@ -49,8 +48,7 @@ void FindHelper::FindAllAsync(const base::string16& search_string) { ...@@ -49,8 +48,7 @@ void FindHelper::FindAllAsync(const base::string16& search_string) {
options.findNext = false; options.findNext = false;
StartNewRequest(search_string); StartNewRequest(search_string);
web_contents()->GetRenderViewHost()->Find(current_request_id_, web_contents()->Find(current_request_id_, search_string, options);
search_string, options);
} }
void FindHelper::HandleFindReply(int request_id, void FindHelper::HandleFindReply(int request_id,
...@@ -74,14 +72,11 @@ void FindHelper::FindNext(bool forward) { ...@@ -74,14 +72,11 @@ void FindHelper::FindNext(bool forward) {
options.matchCase = false; options.matchCase = false;
options.findNext = true; options.findNext = true;
web_contents()->GetRenderViewHost()->Find(current_request_id_, web_contents()->Find(current_request_id_, last_search_string_, options);
last_search_string_,
options);
} }
void FindHelper::ClearMatches() { void FindHelper::ClearMatches() {
web_contents()->GetRenderViewHost()->StopFinding( web_contents()->StopFinding(content::STOP_FIND_ACTION_CLEAR_SELECTION);
content::STOP_FIND_ACTION_CLEAR_SELECTION);
sync_find_started_ = false; sync_find_started_ = false;
async_find_started_ = false; async_find_started_ = false;
......
...@@ -443,7 +443,7 @@ void AutomationProvider::SendFindRequest( ...@@ -443,7 +443,7 @@ void AutomationProvider::SendFindRequest(
options.forward = forward; options.forward = forward;
options.matchCase = match_case; options.matchCase = match_case;
options.findNext = find_next; options.findNext = find_next;
web_contents->GetRenderViewHost()->Find( web_contents->Find(
FindInPageNotificationObserver::kFindInPageRequestId, search_string, FindInPageNotificationObserver::kFindInPageRequestId, search_string,
options); options);
} }
......
...@@ -89,8 +89,7 @@ void FindTabHelper::StartFinding(base::string16 search_string, ...@@ -89,8 +89,7 @@ void FindTabHelper::StartFinding(base::string16 search_string,
options.forward = forward_direction; options.forward = forward_direction;
options.matchCase = case_sensitive; options.matchCase = case_sensitive;
options.findNext = find_next; options.findNext = find_next;
web_contents()->GetRenderViewHost()->Find(current_find_request_id_, web_contents()->Find(current_find_request_id_, find_text_, options);
find_text_, options);
} }
void FindTabHelper::StopFinding( void FindTabHelper::StopFinding(
...@@ -124,7 +123,7 @@ void FindTabHelper::StopFinding( ...@@ -124,7 +123,7 @@ void FindTabHelper::StopFinding(
NOTREACHED(); NOTREACHED();
action = content::STOP_FIND_ACTION_KEEP_SELECTION; action = content::STOP_FIND_ACTION_KEEP_SELECTION;
} }
web_contents()->GetRenderViewHost()->StopFinding(action); web_contents()->StopFinding(action);
} }
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
......
...@@ -2043,12 +2043,6 @@ void RenderViewHostImpl::ReloadFrame() { ...@@ -2043,12 +2043,6 @@ void RenderViewHostImpl::ReloadFrame() {
Send(new ViewMsg_ReloadFrame(GetRoutingID())); Send(new ViewMsg_ReloadFrame(GetRoutingID()));
} }
void RenderViewHostImpl::Find(int request_id,
const base::string16& search_text,
const blink::WebFindOptions& options) {
Send(new ViewMsg_Find(GetRoutingID(), request_id, search_text, options));
}
void RenderViewHostImpl::InsertCSS(const base::string16& frame_xpath, void RenderViewHostImpl::InsertCSS(const base::string16& frame_xpath,
const std::string& css) { const std::string& css) {
Send(new ViewMsg_CSSInsertRequest(GetRoutingID(), frame_xpath, css)); Send(new ViewMsg_CSSInsertRequest(GetRoutingID(), frame_xpath, css));
...@@ -2101,10 +2095,6 @@ void RenderViewHostImpl::NotifyMoveOrResizeStarted() { ...@@ -2101,10 +2095,6 @@ void RenderViewHostImpl::NotifyMoveOrResizeStarted() {
Send(new ViewMsg_MoveOrResizeStarted(GetRoutingID())); Send(new ViewMsg_MoveOrResizeStarted(GetRoutingID()));
} }
void RenderViewHostImpl::StopFinding(StopFindAction action) {
Send(new ViewMsg_StopFinding(GetRoutingID(), action));
}
void RenderViewHostImpl::OnAccessibilityEvents( void RenderViewHostImpl::OnAccessibilityEvents(
const std::vector<AccessibilityHostMsg_EventParams>& params) { const std::vector<AccessibilityHostMsg_EventParams>& params) {
if (view_ && !is_swapped_out_) { if (view_ && !is_swapped_out_) {
......
...@@ -41,7 +41,6 @@ struct ViewHostMsg_SelectionBounds_Params; ...@@ -41,7 +41,6 @@ struct ViewHostMsg_SelectionBounds_Params;
struct ViewHostMsg_ShowPopup_Params; struct ViewHostMsg_ShowPopup_Params;
struct ViewMsg_Navigate_Params; struct ViewMsg_Navigate_Params;
struct ViewMsg_PostMessage_Params; struct ViewMsg_PostMessage_Params;
struct ViewMsg_StopFinding_Params;
namespace base { namespace base {
class ListValue; class ListValue;
...@@ -183,9 +182,6 @@ class CONTENT_EXPORT RenderViewHostImpl ...@@ -183,9 +182,6 @@ class CONTENT_EXPORT RenderViewHostImpl
const gfx::Point& location, const gfx::Point& location,
const blink::WebPluginAction& action) OVERRIDE; const blink::WebPluginAction& action) OVERRIDE;
virtual void ExitFullscreen() OVERRIDE; virtual void ExitFullscreen() OVERRIDE;
virtual void Find(int request_id, const base::string16& search_text,
const blink::WebFindOptions& options) OVERRIDE;
virtual void StopFinding(StopFindAction action) OVERRIDE;
virtual void FirePageBeforeUnload(bool for_cross_site_transition) OVERRIDE; virtual void FirePageBeforeUnload(bool for_cross_site_transition) OVERRIDE;
virtual void FilesSelectedInChooser( virtual void FilesSelectedInChooser(
const std::vector<ui::SelectedFileInfo>& files, const std::vector<ui::SelectedFileInfo>& files,
......
...@@ -2132,6 +2132,16 @@ bool WebContentsImpl::IsSubframe() const { ...@@ -2132,6 +2132,16 @@ bool WebContentsImpl::IsSubframe() const {
return is_subframe_; return is_subframe_;
} }
void WebContentsImpl::Find(int request_id,
const base::string16& search_text,
const blink::WebFindOptions& options) {
Send(new ViewMsg_Find(GetRoutingID(), request_id, search_text, options));
}
void WebContentsImpl::StopFinding(StopFindAction action) {
Send(new ViewMsg_StopFinding(GetRoutingID(), action));
}
bool WebContentsImpl::FocusLocationBarByDefault() { bool WebContentsImpl::FocusLocationBarByDefault() {
NavigationEntry* entry = controller_.GetVisibleEntry(); NavigationEntry* entry = controller_.GetVisibleEntry();
if (entry && entry->GetURL() == GURL(kAboutBlankURL)) if (entry && entry->GetURL() == GURL(kAboutBlankURL))
......
...@@ -283,6 +283,10 @@ class CONTENT_EXPORT WebContentsImpl ...@@ -283,6 +283,10 @@ class CONTENT_EXPORT WebContentsImpl
uint32_t max_bitmap_size, uint32_t max_bitmap_size,
const ImageDownloadCallback& callback) OVERRIDE; const ImageDownloadCallback& callback) OVERRIDE;
virtual bool IsSubframe() const OVERRIDE; virtual bool IsSubframe() const OVERRIDE;
virtual void Find(int request_id,
const base::string16& search_text,
const blink::WebFindOptions& options) OVERRIDE;
virtual void StopFinding(StopFindAction action) OVERRIDE;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents()
OVERRIDE; OVERRIDE;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host.h"
#include "content/public/common/file_chooser_params.h" #include "content/public/common/file_chooser_params.h"
#include "content/public/common/page_zoom.h" #include "content/public/common/page_zoom.h"
#include "content/public/common/stop_find_action.h"
#include "third_party/WebKit/public/web/WebDragOperation.h" #include "third_party/WebKit/public/web/WebDragOperation.h"
class GURL; class GURL;
...@@ -36,7 +35,6 @@ struct SelectedFileInfo; ...@@ -36,7 +35,6 @@ struct SelectedFileInfo;
} }
namespace blink { namespace blink {
struct WebFindOptions;
struct WebMediaPlayerAction; struct WebMediaPlayerAction;
struct WebPluginAction; struct WebPluginAction;
} }
...@@ -181,14 +179,6 @@ class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost { ...@@ -181,14 +179,6 @@ class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost {
// Asks the renderer to exit fullscreen // Asks the renderer to exit fullscreen
virtual void ExitFullscreen() = 0; virtual void ExitFullscreen() = 0;
// Finds text on a page.
virtual void Find(int request_id, const base::string16& search_text,
const blink::WebFindOptions& options) = 0;
// Notifies the renderer that the user has closed the FindInPage window
// (and what action to take regarding the selection).
virtual void StopFinding(StopFindAction action) = 0;
// Causes the renderer to invoke the onbeforeunload event handler. The // Causes the renderer to invoke the onbeforeunload event handler. The
// result will be returned via ViewMsg_ShouldClose. See also ClosePage and // result will be returned via ViewMsg_ShouldClose. See also ClosePage and
// SwapOut, which fire the PageUnload event. // SwapOut, which fire the PageUnload event.
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "content/public/browser/page_navigator.h" #include "content/public/browser/page_navigator.h"
#include "content/public/browser/save_page_type.h" #include "content/public/browser/save_page_type.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "content/public/common/stop_find_action.h"
#include "ipc/ipc_sender.h" #include "ipc/ipc_sender.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
...@@ -32,6 +33,10 @@ namespace base { ...@@ -32,6 +33,10 @@ namespace base {
class TimeTicks; class TimeTicks;
} }
namespace blink {
struct WebFindOptions;
}
namespace gfx { namespace gfx {
class Rect; class Rect;
class Size; class Size;
...@@ -482,6 +487,15 @@ class WebContents : public PageNavigator, ...@@ -482,6 +487,15 @@ class WebContents : public PageNavigator,
// removed since we can then embed iframes in different processes. // removed since we can then embed iframes in different processes.
virtual bool IsSubframe() const = 0; virtual bool IsSubframe() const = 0;
// Finds text on a page.
virtual void Find(int request_id,
const base::string16& search_text,
const blink::WebFindOptions& options) = 0;
// Notifies the renderer that the user has closed the FindInPage window
// (and what action to take regarding the selection).
virtual void StopFinding(StopFindAction action) = 0;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
CONTENT_EXPORT static WebContents* FromJavaWebContents( CONTENT_EXPORT static WebContents* FromJavaWebContents(
jobject jweb_contents_android); jobject jweb_contents_android);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment