cefclient_win.cpp
- end of InitInstance()
- in WndProcess at the end of the WM_CREATE case
client_handler.cpp
- in ClientHandler::OnAfterCreated
The modification was never effective, like if the page as to be loaded before I can modify a zoom level. For a debugging purpose, I threw a messagebox in the "ModifyZoom(CefRefPtr<CefBrowser> browser, double delta)" function to make sure it was going through that code. That way, zoom level applied correctly, but not when I removed the messageBox.
The way i found it to work was adding the call to setzoomlevel in ClientHandler::OnLoadingStateChange every time a page is loaded. It works but that's not very clean. Would there be a prettier way of doing that ?
Thank you
- Code: Select all
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
bool isLoading,
bool canGoBack,
bool canGoForward) {
REQUIRE_UI_THREAD();
char str[256];
SetLoading(isLoading);
SetNavState(canGoBack, canGoForward);
if (!isLoading) {
if(browser->GetHost()->GetZoomLevel() != ZOOM_LEVEL)
browser->GetHost()->SetZoomLevel(ZOOM_LEVEL);
sprintf(str, "OnLoadingStateChange notLoading\n");
OutputDebugStringA(str);
// Continue the DOM test.
if (browser->GetMainFrame()->GetURL() == dom_test::kTestUrl)
dom_test::OnLoadEnd(browser);
}
else
{
sprintf(str, "OnLoadingStateChange Loading\n");
OutputDebugStringA(str);
}
}