diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 18:19:00 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 18:19:00 +0000 |
commit | 5bc8fe91607f20f2d43dc461ca188dd07b55d435 (patch) | |
tree | ca6551f9d816757942485ee7d3542c5aeb4d2fed /chrome/renderer | |
parent | 3148c0ae4462e01f4b830b8d2150dcd7fee2cb3b (diff) | |
download | chromium_src-5bc8fe91607f20f2d43dc461ca188dd07b55d435.zip chromium_src-5bc8fe91607f20f2d43dc461ca188dd07b55d435.tar.gz chromium_src-5bc8fe91607f20f2d43dc461ca188dd07b55d435.tar.bz2 |
Allow users to close the find session and activate the current link via ctrl-enter.
this only hooks up ctrl-enter on gtk for now, but adding it on windows/mac should be trivial
webkit side, which needs to land first, is here:
https://bugs.webkit.org/show_bug.cgi?id=35407
This also enables the FindInPageControllerTest tests on linux/gtk.
BUG=29500
TEST=FindInPageControllerTest.ActivateLinkNavigatesPage
Review URL: http://codereview.chromium.org/660137
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 17 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index f18d06b..12394b2 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -146,6 +146,7 @@ using WebKit::WebCString; using WebKit::WebData; using WebKit::WebDataSource; using WebKit::WebDevToolsAgent; +using WebKit::WebDocument; using WebKit::WebDragData; using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; @@ -980,11 +981,13 @@ void RenderView::OnSetupDevToolsClient() { devtools_client_.reset(new DevToolsClient(this)); } -void RenderView::OnStopFinding(bool clear_selection) { +void RenderView::OnStopFinding(const ViewMsg_StopFinding_Params& params) { WebView* view = webview(); if (!view) return; + bool clear_selection = + params.action == ViewMsg_StopFinding_Params::kClearSelection; if (clear_selection) view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); @@ -993,6 +996,18 @@ void RenderView::OnStopFinding(bool clear_selection) { frame->stopFinding(clear_selection); frame = frame->traverseNext(false); } + + if (params.action == ViewMsg_StopFinding_Params::kActivateSelection) { + WebFrame* focused_frame = view->focusedFrame(); + if (focused_frame) { + WebDocument doc = focused_frame->document(); + if (!doc.isNull()) { + WebNode node = doc.focusedNode(); + if (!node.isNull()) + node.simulateClick(); + } + } + } } void RenderView::OnFindReplyAck() { diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index b0db68f..d32ce57 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -613,7 +613,7 @@ class RenderView : public RenderWidget, bool new_navigation, const GURL& display_url, const std::string& security_info); - void OnStopFinding(bool clear_selection); + void OnStopFinding(const ViewMsg_StopFinding_Params& params); void OnFindReplyAck(); void OnUpdateTargetURLAck(); void OnUndo(); |