diff --git a/CefSharp.Core/Internals/ClientAdapter.cpp b/CefSharp.Core/Internals/ClientAdapter.cpp index 559eb947d..3f9feeb10 100644 --- a/CefSharp.Core/Internals/ClientAdapter.cpp +++ b/CefSharp.Core/Internals/ClientAdapter.cpp @@ -154,6 +154,16 @@ namespace CefSharp } } + void ClientAdapter::OnFaviconURLChange(CefRefPtr browser, const std::vector& iconUrls) + { + auto handler = _browserControl->RequestHandler; + + if(handler != nullptr) + { + handler->OnFaviconUrlChange(_browserControl, StringUtils::ToClr(iconUrls)); + } + } + bool ClientAdapter::OnTooltip(CefRefPtr browser, CefString& text) { String^ tooltip = StringUtils::ToClr(text); diff --git a/CefSharp.Core/Internals/ClientAdapter.h b/CefSharp.Core/Internals/ClientAdapter.h index 507345a8d..69e1e4aa6 100644 --- a/CefSharp.Core/Internals/ClientAdapter.h +++ b/CefSharp.Core/Internals/ClientAdapter.h @@ -107,6 +107,7 @@ namespace CefSharp virtual DECL void OnLoadingStateChange(CefRefPtr browser, bool isLoading, bool canGoBack, bool canGoForward) OVERRIDE; virtual DECL void OnAddressChange(CefRefPtr browser, CefRefPtr frame, const CefString& url) OVERRIDE; virtual DECL void OnTitleChange(CefRefPtr browser, const CefString& title) OVERRIDE; + virtual DECL void OnFaviconURLChange(CefRefPtr browser, const std::vector& iconUrls) OVERRIDE; virtual DECL bool OnTooltip(CefRefPtr browser, CefString& text) OVERRIDE; virtual DECL bool OnConsoleMessage(CefRefPtr browser, const CefString& message, const CefString& source, int line) OVERRIDE; virtual DECL void OnStatusMessage(CefRefPtr browser, const CefString& message) OVERRIDE; diff --git a/CefSharp.Example/RequestHandler.cs b/CefSharp.Example/RequestHandler.cs index 9032ad9df..9f3f00fe0 100644 --- a/CefSharp.Example/RequestHandler.cs +++ b/CefSharp.Example/RequestHandler.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace CefSharp.Example { @@ -71,5 +72,10 @@ namespace CefSharp.Example { return url.StartsWith("mailto"); } + + public void OnFaviconUrlChange(IWebBrowser browser, IList urls) + { + var url = urls[0]; + } } } diff --git a/CefSharp/IRequestHandler.cs b/CefSharp/IRequestHandler.cs index 89dcc1d35..c6bf99d6d 100644 --- a/CefSharp/IRequestHandler.cs +++ b/CefSharp/IRequestHandler.cs @@ -3,6 +3,7 @@ // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; +using System.Collections.Generic; namespace CefSharp { @@ -108,5 +109,12 @@ namespace CefSharp /// the request url /// return to true to attempt execution via the registered OS protocol handler, if any. Otherwise return false. bool OnProtocolExecution(IWebBrowser browser, string url); + + /// + /// Called when the page icon changes. + /// + /// the browser object + /// list of urls where the favicons can be downloaded + void OnFaviconUrlChange(IWebBrowser browser, IList urls); } }