Skip to content

Commit

Permalink
#159: Changed the IJavascriptProxy.EvaluateScript() method signature …
Browse files Browse the repository at this point in the history
…a bit, to try and get it working with the cross-process scenario which is a reality w/ CEF3.
  • Loading branch information
perlun committed Sep 2, 2013
1 parent 0645da4 commit 632f016
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions CefSharp/CefBrowserWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,18 @@ namespace CefSharp

Object^ EvaluateScript(String^ script, TimeSpan timeout)
{
// TODO: implement the browserprocess and make it implement IScriptProxy, and set up a WCF listener.
return _javaScriptProxy->EvaluateScript(script, timeout.TotalMilliseconds);
auto browser = _renderClientAdapter->GetCefBrowser();
auto frame = _renderClientAdapter->TryGetCefMainFrame();

if (browser != nullptr &&
frame != nullptr)
{
return _javaScriptProxy->EvaluateScript(browser->GetIdentifier(), frame->GetIdentifier(), script, timeout.TotalMilliseconds);
}
else
{
return nullptr;
}

//auto browser = _renderClientAdapter->GetCefBrowser();

Expand Down
6 changes: 3 additions & 3 deletions CefSharp/Internals/JavascriptBinding/IJavascriptProxy.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2010-2013 The CefSharp Project. All rights reserved.
// Copyright © 2013 The CefSharp Project. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Expand All @@ -11,12 +11,12 @@ namespace CefSharp
namespace JavascriptBinding
{
// TODO: Should be internal (a.k.a. private in C++), but I couldn't manage to get InternalsVisibleTo functioning
// between C++ projects...
// properly between C++ projects...
[ServiceContract]
public interface class IJavascriptProxy
{
[OperationContract]
Object^ EvaluateScript(String^ script, double timeout);
Object^ EvaluateScript(int browserId, int frameId, String^ script, double timeout);
};
}
}
Expand Down

0 comments on commit 632f016

Please sign in to comment.