- Add CefBrowser::ExecuteJavaScript() method.
tests/cefclient:
- Add test for ExecuteJavaScript method.

Issue 1, Suggested implementation by: vridosh


git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@12 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-01-29 17:48:16 +00:00
parent 729f9279bc
commit 9d3cd36b4b
6 changed files with 58 additions and 7 deletions

View File

@ -154,6 +154,16 @@ void CefBrowserImpl::LoadStream(CefRefPtr<CefStreamReader> stream,
&CefBrowserImpl::UIT_LoadHTMLForStreamRef, stream.get(), url));
}
void CefBrowserImpl::ExecuteJavaScript(const std::wstring& js_code,
const std::wstring& script_url,
int start_line,
TargetFrame targetFrame)
{
PostTask(FROM_HERE, NewRunnableMethod(this,
&CefBrowserImpl::UIT_ExecuteJavaScript, js_code, script_url, start_line,
targetFrame));
}
bool CefBrowserImpl::AddJSHandler(const std::wstring& classname,
CefRefPtr<CefJSHandler> handler)
{
@ -310,6 +320,22 @@ void CefBrowserImpl::UIT_LoadURLForRequestRef(CefRequest* request)
request->Release();
}
void CefBrowserImpl::UIT_ExecuteJavaScript(const std::wstring& js_code,
const std::wstring& script_url,
int start_line,
TargetFrame targetFrame)
{
REQUIRE_UIT();
WebFrame* frame;
if(targetFrame == TF_FOCUSED)
frame = UIT_GetWebView()->GetFocusedFrame();
else
frame = UIT_GetWebView()->GetMainFrame();
frame->ExecuteJavaScript(WideToUTF8(js_code), GURL(script_url), start_line);
}
void CefBrowserImpl::UIT_GoBackOrForward(int offset)
{
REQUIRE_UIT();