diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index a4a8bbe2344413d3f16ffe28fd5308f9828a562b..0bed6b038ab61d90bb6bd52534cbcfb138c4fc38 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 ee8ed0aea5243eeeb9549b6e9e2528e0ef8bd1c3..3adec21418f8666ec482907f26d6e1628c97c536 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 8d4267b538e2653ff641aeb09f88d3dcc6dcdf31..33dc0cae832bd70d715a1705ad1e22bd2c517f0c 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 b56cdd8832814221acd0846797f4f472342f2ef1..5061facd65bffd78514436955ce889b205b3673a 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: