diff --git a/include/QCefView.h b/include/QCefView.h
index d2d79f44..c3d47828 100644
--- a/include/QCefView.h
+++ b/include/QCefView.h
@@ -257,6 +257,18 @@ class QCEFVIEW_EXPORT QCefView : public QWidget
/// The title
void titleChanged(const QString& title);
+ ///
+ /// Gets called on title changed
+ ///
+ /// The urls
+ void faviconURLChanged(const QStringList& urls);
+
+ ///
+ /// Gets called on title changed
+ ///
+ /// The icon
+ void faviconChanged(const QIcon &icon);
+
///
/// Gets called on fullscreen mode changed
///
diff --git a/src/details/CCefClientDelegate.h b/src/details/CCefClientDelegate.h
index b78115ab..33dcf475 100644
--- a/src/details/CCefClientDelegate.h
+++ b/src/details/CCefClientDelegate.h
@@ -100,6 +100,8 @@ class CCefClientDelegate : public CefViewBrowserClientDelegateInterface
const std::vector& regions) override;
virtual void addressChanged(CefRefPtr& browser, int64_t frameId, const std::string& url) override;
virtual void titleChanged(CefRefPtr& browser, const std::string& title) override;
+ virtual void faviconURLChanged(CefRefPtr browser, const std::vector& icon_urls) override;
+ virtual void faviconChanged(CefRefPtr image) override;
virtual void fullscreenModeChanged(CefRefPtr& browser, bool fullscreen) override;
virtual bool tooltipMessage(CefRefPtr& browser, const std::string& text) override;
virtual void statusMessage(CefRefPtr& browser, const std::string& value) override;
diff --git a/src/details/CCefClientDelegate_DisplayHandler.cpp b/src/details/CCefClientDelegate_DisplayHandler.cpp
index 9277440a..000f8487 100644
--- a/src/details/CCefClientDelegate_DisplayHandler.cpp
+++ b/src/details/CCefClientDelegate_DisplayHandler.cpp
@@ -1,7 +1,8 @@
#include "CCefClientDelegate.h"
#include
-
+#include
+#include
#include "QCefViewPrivate.h"
Qt::CursorShape
@@ -104,6 +105,45 @@ CCefClientDelegate::titleChanged(CefRefPtr& browser, const std::stri
pCefViewPrivate_->q_ptr->titleChanged(t);
}
+void
+CCefClientDelegate::faviconURLChanged(CefRefPtr browser, const std::vector& icon_urls)
+{
+ if (!IsValidBrowser(browser))
+ return;
+
+ QStringList urls;
+ for (int i = 0; i < icon_urls.size(); i++)
+ {
+ urls.append(QString::fromStdString(icon_urls.at(i).ToString()));
+ }
+ pCefViewPrivate_->q_ptr->faviconURLChanged(urls);
+}
+
+void
+CCefClientDelegate::faviconChanged(CefRefPtr image)
+{
+ QIcon icon;
+
+ //图像转换
+ int width = 0;
+ int height = 0;
+ CefRefPtr data = image->GetAsPNG(1.0, true, width, height);
+ int bufsize = (int)data->GetSize();
+ if (bufsize > 0)
+ {
+ QByteArray buffer(bufsize + 4, char(0));
+ data->GetData(buffer.data(), bufsize, 0);
+
+ QBitmap bitmap;
+ bitmap.loadFromData(buffer);
+
+ icon = QIcon(bitmap);
+ }
+
+ //发出信号
+ pCefViewPrivate_->q_ptr->faviconChanged(icon);
+}
+
void
CCefClientDelegate::fullscreenModeChanged(CefRefPtr& browser, bool fullscreen)
{