summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-19 11:40:46 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-19 13:27:58 +0200
commit2db9af9251c54cfc6eab46df5b77559f3c8c0a0b (patch)
tree0c4023d547d9bff58a008d870c39864f5373999a
parent1643f41cfb0ec46faa7bf411088b6f74d9339fff (diff)
Add iconUrl() to QWebEngineHistoryItem
Change-Id: I61bda1aafc7513acdaeda99ef493ce50363d352e Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--src/core/web_contents_adapter.cpp10
-rw-r--r--src/core/web_contents_adapter.h1
-rw-r--r--src/webenginewidgets/api/qwebenginehistory.cpp6
-rw-r--r--src/webenginewidgets/api/qwebenginehistory.h1
4 files changed, 18 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index a4a8bbe2..0bed6b03 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -592,6 +592,16 @@ QDateTime WebContentsAdapter::getNavigationEntryTimestamp(int index)
return entry ? toQt(entry->GetTimestamp()) : QDateTime();
}
+QUrl WebContentsAdapter::getNavigationEntryIconUrl(int index)
+{
+ Q_D(WebContentsAdapter);
+ content::NavigationEntry *entry = d->webContents->GetController().GetEntryAtIndex(index);
+ if (!entry)
+ return QUrl();
+ content::FaviconStatus favicon = entry->GetFavicon();
+ return favicon.valid ? toQt(favicon.url) : QUrl();
+}
+
void WebContentsAdapter::clearNavigationHistory()
{
Q_D(WebContentsAdapter);
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index ee8ed0ae..3adec214 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -95,6 +95,7 @@ public:
QUrl getNavigationEntryUrl(int index);
QString getNavigationEntryTitle(int index);
QDateTime getNavigationEntryTimestamp(int index);
+ QUrl getNavigationEntryIconUrl(int index);
void clearNavigationHistory();
void serializeNavigationHistory(QDataStream &output);
void setZoomFactor(qreal);
diff --git a/src/webenginewidgets/api/qwebenginehistory.cpp b/src/webenginewidgets/api/qwebenginehistory.cpp
index 8d4267b5..33dc0cae 100644
--- a/src/webenginewidgets/api/qwebenginehistory.cpp
+++ b/src/webenginewidgets/api/qwebenginehistory.cpp
@@ -97,6 +97,12 @@ QDateTime QWebEngineHistoryItem::lastVisited() const
return d->page ? d->page->webContents()->getNavigationEntryTimestamp(d->index) : QDateTime();
}
+QUrl QWebEngineHistoryItem::iconUrl() const
+{
+ Q_D(const QWebEngineHistoryItem);
+ return d->page ? d->page->webContents()->getNavigationEntryIconUrl(d->index) : QUrl();
+}
+
bool QWebEngineHistoryItem::isValid() const
{
Q_D(const QWebEngineHistoryItem);
diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/webenginewidgets/api/qwebenginehistory.h
index b56cdd88..5061facd 100644
--- a/src/webenginewidgets/api/qwebenginehistory.h
+++ b/src/webenginewidgets/api/qwebenginehistory.h
@@ -46,6 +46,7 @@ public:
QString title() const;
QDateTime lastVisited() const;
+ QUrl iconUrl() const;
bool isValid() const;
private: