summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_delegate_qt.cpp
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2014-03-25 10:24:46 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-01 18:13:12 +0200
commitd13d953feceb2e72959f7b9aaf45720dcae49e8a (patch)
tree930acfb8d0e744e5b1f7a648bcd0ef3cb93da6b2 /src/core/web_contents_delegate_qt.cpp
parentdb46baffab77cd546f16b4b4ccf09bc86d9ef208 (diff)
Fix iconChanged signal and add favIconLoad QML test
If WebContentsDelegateQt::DidUpdateFaviconURL was not called after a page load, we need to reset the favicon URL. We can use the navigation entries to store favicon related information. Change-Id: I7bcfbd46c176fabce319eba32c379a293f8ebba6 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r--src/core/web_contents_delegate_qt.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index a803e8d4b..4ac20825a 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -46,9 +46,11 @@
#include "web_contents_adapter_client.h"
#include "web_engine_context.h"
+#include "content/public/browser/favicon_status.h"
+#include "content/public/browser/invalidate_type.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/browser/invalidate_type.h"
#include "content/public/common/favicon_url.h"
#include "content/public/common/file_chooser_params.h"
@@ -121,8 +123,18 @@ void WebContentsDelegateQt::DidFailLoad(int64, const GURL&, bool is_main_frame,
void WebContentsDelegateQt::DidFinishLoad(int64, const GURL&, bool is_main_frame, content::RenderViewHost*)
{
- if (is_main_frame)
+ if (is_main_frame) {
m_viewClient->loadFinished(true);
+
+ content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry();
+ if (!entry)
+ return;
+ content::FaviconStatus &favicon = entry->GetFavicon();
+ if (favicon.valid)
+ m_viewClient->iconChanged(toQt(favicon.url));
+ else
+ m_viewClient->iconChanged(QUrl());
+ }
}
void WebContentsDelegateQt::DidUpdateFaviconURL(int32 page_id, const std::vector<content::FaviconURL>& candidates)
@@ -130,7 +142,12 @@ void WebContentsDelegateQt::DidUpdateFaviconURL(int32 page_id, const std::vector
Q_UNUSED(page_id)
Q_FOREACH (content::FaviconURL candidate, candidates) {
if (candidate.icon_type == content::FaviconURL::FAVICON && !candidate.icon_url.is_empty()) {
- m_viewClient->iconChanged(toQt(candidate.icon_url));
+ content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry();
+ if (!entry)
+ continue;
+ content::FaviconStatus &favicon = entry->GetFavicon();
+ favicon.url = candidate.icon_url;
+ favicon.valid = toQt(candidate.icon_url).isValid();
break;
}
}