Add search/find support (issue #513).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1482 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-10-23 22:44:12 +00:00
parent bc1ea4974a
commit c7d7b9fbbf
10 changed files with 212 additions and 0 deletions

View File

@ -48,6 +48,7 @@
#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/file_chooser_params.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/shell_dialogs/selected_file_info.h"
namespace {
@ -616,6 +617,39 @@ void CefBrowserHostImpl::Print() {
}
}
void CefBrowserHostImpl::Find(int identifier, const CefString& searchText,
bool forward, bool matchCase, bool findNext) {
if (CEF_CURRENTLY_ON_UIT()) {
if (!web_contents_)
return;
WebKit::WebFindOptions options;
options.forward = forward;
options.matchCase = matchCase;
options.findNext = findNext;
web_contents()->GetRenderViewHost()->Find(identifier, searchText, options);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::Find, this, identifier, searchText,
forward, matchCase, findNext));
}
}
void CefBrowserHostImpl::StopFinding(bool clearSelection) {
if (CEF_CURRENTLY_ON_UIT()) {
if (!web_contents_)
return;
content::StopFindAction action = clearSelection ?
content::STOP_FIND_ACTION_CLEAR_SELECTION :
content::STOP_FIND_ACTION_KEEP_SELECTION;
web_contents()->GetRenderViewHost()->StopFinding(action);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::StopFinding, this, clearSelection));
}
}
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
base::AutoLock lock_scope(state_lock_);
mouse_cursor_change_disabled_ = disabled;