Thanks for your reply.
I read this link
https://bitbucket.org/chromiumembedded/ ... t-bindings
what I understood is, we can run a javascript code through our render process and can recieve message in render process by running this javascript.
but in my case i have scenario like below -->
i have third party website which i need to load in my CEF browser. this website has a href link (ex- "resize me"). by clicking this link it resizes the page. It calls a javascript function to resize itself. (I find the Javascript function name by inspecting this webpage)
Now I also want to resize my CEF Browser window, when user clicks on "resize me" link on webpage to resize the page.
I cannot change code for this website page. What i can do is change our CEF browser window size through our c++ code accordingly.
So how can my c++ code knows when user clicks on the link present on this Website. I just want a callback to my code.
I am new to CEF sdk so can you please help me out with some sample code for handlers.
So far what i did -->
Website Page executes --> "hideShowForm();" javascript function which shrinks the page.
In my Code -->
class CEFApplication : public CefApp, public CefBrowserProcessHandler, public CefRenderProcessHandler, public CefV8Handler
{
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE { return this; }
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() OVERRIDE { return this; }
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE
{
CefString cefstrFuncName = message->GetName();
// should i get a callback here for function name "hideShowForm();" ...?
}
virtual void OnContextInitialized() OVERRIDE
{
}
virtual void OnWebKitInitialized() OVERRIDE
{
}
virtual bool Execute(const CefString& name,
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
CefString& exception) OVERRIDE
{
if (name == "hideShowForm") // Should I check like this ..?
{ }
return false;
}
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context) OVERRIDE
{
// Retrieve the context's window object.
CefRefPtr<CefV8Value> object = context->GetGlobal();
CefRefPtr<CefV8Handler> handler = new CEFApplication();
CefRefPtr<CefV8Value> func = CefV8Value::CreateFunction("hideShowForm", handler);
// Add the "hideShowForm" function to the "window" object.
object->SetValue("hideShowForm", func, V8_PROPERTY_ATTRIBUTE_NONE);
}
private:
IMPLEMENT_REFCOUNTING(CEFApplication);
};
my code did not hit any breakpoint on any of these above functions.
I might be confused with my understandings.
your help is really appreciated.
Thank you.