Send WEBVIEW_ERROR event after CEF finishing loading.

Currently, WEBVIEW_ERROR event is sent to client on CEF::OnLoadError(),
which may cause the error message of wxInfoBar disapear.

CEF::OnLoadEnd will be invoked after CEF::OnloadError, if WEBVIEW_ERROR
event get processed before CEF::LoadEnd, the wxInfoBar's message will
disappear since the webpage will get loaded in CEF::LoadEnd.

CEF will return "data:text/html,chromewebdata" when url is invalid.
This commit is contained in:
Haojian Wu 2014-05-17 19:44:29 +08:00 committed by Tobias Taschner
parent 450bece977
commit cd7df9c28b
No known key found for this signature in database
GPG key ID: AE6ECD71294F87FD
2 changed files with 14 additions and 12 deletions

View file

@ -39,7 +39,7 @@ class ClientHandler : public CefClient,
public CefLoadHandler
{
public:
ClientHandler() {};
ClientHandler():m_loadErrorCode(-1) {};
virtual ~ClientHandler() {};
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() { return this; }
@ -108,7 +108,9 @@ private:
CefRefPtr<CefBrowser> m_browser;
wxWebViewChromium *m_webview;
int m_browserId;
// Record the load error code: enum wxWebViewNavigationError
// -1 means no error.
int m_loadErrorCode;
IMPLEMENT_REFCOUNTING(ClientHandler);
};