summaryrefslogtreecommitdiffstats
path: root/lib/web_contents_delegate_qt.cpp
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@digia.com>2013-08-02 13:12:08 +0200
committerPierre Rossi <pierre.rossi@gmail.com>2013-08-02 14:53:28 +0200
commitd7dd93cf6e3540855055ba08639161104a77bc3a (patch)
tree1777bb2722cb67ce9b06590aee131b792e8f1210 /lib/web_contents_delegate_qt.cpp
parentd1e168102555e903d41394484f5a8a0c13f1548f (diff)
Implement more detailed load information handling.
Add WebContentsObserver as a base class of WebContentsDelegateQt to be able to get more information about the WebContents (loading state etc.). Also implements load finished with a success value to be able to show when a load has failed. Change-Id: Ic2ad698d180b395cf3d9fb6cd49b12c9cb4fb493 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'lib/web_contents_delegate_qt.cpp')
-rw-r--r--lib/web_contents_delegate_qt.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/web_contents_delegate_qt.cpp b/lib/web_contents_delegate_qt.cpp
index 72a50ac1d..9cadf4b60 100644
--- a/lib/web_contents_delegate_qt.cpp
+++ b/lib/web_contents_delegate_qt.cpp
@@ -80,6 +80,7 @@ WebContentsDelegateQt::WebContentsDelegateQt(content::BrowserContext* browser_co
m_webContents->GetRenderViewHost()->SyncRendererPrefs();
m_webContents->SetDelegate(this);
+ this->Observe(m_webContents.get());
}
void WebContentsDelegateQt::NavigationStateChanged(const content::WebContents* source, unsigned changed_flags)
@@ -97,6 +98,19 @@ void WebContentsDelegateQt::LoadingStateChanged(content::WebContents* source)
m_viewClient->loadingStateChanged();
}
+void WebContentsDelegateQt::DidFailLoad(int64 frame_id, const GURL &validated_url, bool is_main_frame, int error_code, const string16 &error_description, content::RenderViewHost *render_view_host)
+{
+ if (is_main_frame)
+ m_viewClient->loadFinished(false);
+}
+
+void WebContentsDelegateQt::DidFinishLoad(int64 frame_id, const GURL &validated_url, bool is_main_frame, content::RenderViewHost *render_view_host)
+{
+ if (is_main_frame)
+ m_viewClient->loadFinished(true);
+}
+
+
content::WebContents* WebContentsDelegateQt::web_contents()
{
return m_webContents.get();