[Qt][WK2] Implement favicon support
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Dec 2011 11:49:21 +0000 (11:49 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Dec 2011 11:49:21 +0000 (11:49 +0000)
commit159c0346c6020a68912ed20a2f237d71fa20d2fd
tree179f0c93c5d923e85af866b03bf1a74de592540a
parentd0238954a86434c7a1789cd1366f05b0283e9080
[Qt][WK2] Implement favicon support
https://bugs.webkit.org/show_bug.cgi?id=71082

Patch by Rafael Brandao <rafael.lobo@openbossa.org> on 2011-12-20
Reviewed by Simon Hausmann.

.:

* Source/qtwebkit-export.map: Added new classes.

Source/WebKit/qt:

* declarative/plugin.cpp:
(WebKitQmlPlugin::initializeEngine): Setup for the QDeclarativeImageProvider to display favicons.
Its handles the following url format: "image://webicon/<iconID>#<pageURL>".

Source/WebKit2:

Added attribute to QQuickWebView named "icon" that should be used
as source for QQuickImage in order to display it. All images
pointing to it will refresh when the icon is ready. We also use IDs
to make it possible to handle different icons for the same page URL
at different times (i.e. dynamically changing favicon).

IconDatabase storage lies on UIProcess and the synchronous call for
the icon that happens on WebIconDatabase won't need to send any message
to WebProcess. The part of IconDatabase on WebProcess handles the download
of the resource whenever it is needed. Then the content downloaded is sent
through IPC to the actual database, on UIProcess.

* Target.pri:
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::initialize):
(QQuickWebViewPrivate::_q_onIconChangedForPageURL):
(QQuickWebViewPrivate::setIcon):
(QQuickWebView::icon):
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
* UIProcess/API/qt/qwebiconimageprovider.cpp: Added.
(QWebIconImageProvider::QWebIconImageProvider):
(QWebIconImageProvider::~QWebIconImageProvider):
(QWebIconImageProvider::requestImage):
* UIProcess/API/qt/qwebiconimageprovider_p.h: Added.
* UIProcess/WebContext.h:
* UIProcess/WebIconDatabase.cpp:
(WebKit::WebIconDatabase::synchronousIconURLForPageURL):
(WebKit::WebIconDatabase::imageForPageURL): Added iconSize parameter
and a default value for it to not break the old usage. The support for
multiple sizes of favicons is still missing on WebCore.
* UIProcess/WebIconDatabase.h:
* UIProcess/qt/QtWebContext.cpp:
(WebKit::QtWebContext::initialize):
* UIProcess/qt/QtWebContext.h:
(WebKit::QtWebContext::iconDatabase):
* UIProcess/qt/QtWebIconDatabaseClient.cpp: Added.
(toQtWebIconDatabaseClient):
(QtWebIconDatabaseClient::QtWebIconDatabaseClient):
(QtWebIconDatabaseClient::~QtWebIconDatabaseClient):
(QtWebIconDatabaseClient::didChangeIconForPageURL):
(QtWebIconDatabaseClient::iconImageForPageURL):
(QtWebIconDatabaseClient::iconURLHashForPageURL):
(QtWebIconDatabaseClient::requestIconForPageURL):
(QtWebIconDatabaseClient::retainIconForPageURL):
(QtWebIconDatabaseClient::releaseIconForPageURL):
* UIProcess/qt/QtWebIconDatabaseClient.h: Added.
* UIProcess/qt/QtWebPageLoadClient.cpp:
(QtWebPageLoadClient::didStartProgress):

Tools:

A favorite icon was added on MiniBrowser's url bar as example.
We display a default icon when the page doesn't have an icon ready.

* MiniBrowser/qt/MiniBrowser.qrc:
* MiniBrowser/qt/icons/favicon.png: Added.
* MiniBrowser/qt/qml/BrowserWindow.qml:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
ChangeLog
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/declarative/plugin.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/WebIconDatabase.cpp
Source/WebKit2/UIProcess/WebIconDatabase.h
Source/WebKit2/UIProcess/qt/QtWebContext.cpp
Source/WebKit2/UIProcess/qt/QtWebContext.h
Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h [new file with mode: 0644]
Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
Source/qtwebkit-export.map
Tools/ChangeLog
Tools/MiniBrowser/qt/MiniBrowser.qrc
Tools/MiniBrowser/qt/icons/favicon.png [new file with mode: 0644]
Tools/MiniBrowser/qt/qml/BrowserWindow.qml