2011-03-26 Andreas Kling <kling@webkit.org>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] QWebFrame::iconChanged() not emitted when icon is cached but not yet loaded
        https://bugs.webkit.org/show_bug.cgi?id=57157

        Add an IconDatabaseClient for the Qt port to ensure that QWebFrame::iconChanged()
        is always emitted when appropriate.

        * QtWebKit.pro: Add new files.

        * WebCoreSupport/IconDatabaseClientQt.h: Added.
        * WebCoreSupport/IconDatabaseClientQt.cpp: Added.
        (WebCore::IconDatabaseClientQt::instance):
        (WebCore::IconDatabaseClientQt::IconDatabaseClientQt):
        (WebCore::IconDatabaseClientQt::~IconDatabaseClientQt):
        (WebCore::IconDatabaseClientQt::performImport):
        (WebCore::IconDatabaseClientQt::didRemoveAllIcons):
        (WebCore::IconDatabaseClientQt::didImportIconURLForPageURL):
        (WebCore::IconDatabaseClientQt::didImportIconDataForPageURL):
        (WebCore::IconDatabaseClientQt::didChangeIconForPageURL):
        (WebCore::IconDatabaseClientQt::didFinishURLImport):

        * WebCoreSupport/FrameLoaderClientQt.h:
        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::registerForIconNotification):
        (WebCore::FrameLoaderClientQt::onIconLoadedForPageURL): New slot connected
        to the IconDatabaseClientQt::iconLoadedForPageURL() signal. This emits the
        QWebFrame::iconChanged() signal when the IconDatabases finishes loading
        a cached favicon for the frame's URL.

        * Api/qwebsettings.cpp:
        (QWebSettings::setIconDatabasePath): Make sure that IconDatabaseClientQt is
        instantiated. An IconDatabaseClient has to be registered before the IconDatabase
        spawns its reader thread.


git-svn-id: svn://svn.chromium.org/blink/trunk@82034 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 29644f8b
......@@ -28,6 +28,9 @@
#include "MemoryCache.h"
#include "CrossOriginPreflightResultCache.h"
#include "FontCache.h"
#if ENABLE(ICONDATABASE)
#include "IconDatabaseClientQt.h"
#endif
#include "Page.h"
#include "PageCache.h"
#include "Settings.h"
......@@ -636,6 +639,11 @@ QString QWebSettings::defaultTextEncoding() const
*/
void QWebSettings::setIconDatabasePath(const QString& path)
{
#if ENABLE(ICONDATABASE)
// Make sure that IconDatabaseClientQt is instantiated.
WebCore::IconDatabaseClientQt::instance();
#endif
WebCore::IconDatabase::delayDatabaseCleanup();
if (!path.isEmpty()) {
......
2011-03-26 Andreas Kling <kling@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] QWebFrame::iconChanged() not emitted when icon is cached but not yet loaded
https://bugs.webkit.org/show_bug.cgi?id=57157
Add an IconDatabaseClient for the Qt port to ensure that QWebFrame::iconChanged()
is always emitted when appropriate.
* QtWebKit.pro: Add new files.
* WebCoreSupport/IconDatabaseClientQt.h: Added.
* WebCoreSupport/IconDatabaseClientQt.cpp: Added.
(WebCore::IconDatabaseClientQt::instance):
(WebCore::IconDatabaseClientQt::IconDatabaseClientQt):
(WebCore::IconDatabaseClientQt::~IconDatabaseClientQt):
(WebCore::IconDatabaseClientQt::performImport):
(WebCore::IconDatabaseClientQt::didRemoveAllIcons):
(WebCore::IconDatabaseClientQt::didImportIconURLForPageURL):
(WebCore::IconDatabaseClientQt::didImportIconDataForPageURL):
(WebCore::IconDatabaseClientQt::didChangeIconForPageURL):
(WebCore::IconDatabaseClientQt::didFinishURLImport):
* WebCoreSupport/FrameLoaderClientQt.h:
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::registerForIconNotification):
(WebCore::FrameLoaderClientQt::onIconLoadedForPageURL): New slot connected
to the IconDatabaseClientQt::iconLoadedForPageURL() signal. This emits the
QWebFrame::iconChanged() signal when the IconDatabases finishes loading
a cached favicon for the frame's URL.
* Api/qwebsettings.cpp:
(QWebSettings::setIconDatabasePath): Make sure that IconDatabaseClientQt is
instantiated. An IconDatabaseClient has to be registered before the IconDatabase
spawns its reader thread.
2011-03-25 Andy Estes <aestes@apple.com>
Reviewed by Adele Peterson.
......
......@@ -218,6 +218,15 @@ contains(DEFINES, ENABLE_VIDEO=1) {
}
}
contains(DEFINES, ENABLE_ICONDATABASE=1) {
HEADERS += \
$$PWD/WebCoreSupport/IconDatabaseClient.h \
$$PWD/WebCoreSupport/IconDatabaseClientQt.h
SOURCES += \
$$PWD/WebCoreSupport/IconDatabaseClientQt.cpp
}
contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
HEADERS += \
$$PWD/WebCoreSupport/DeviceMotionClientQt.h \
......
......@@ -40,6 +40,9 @@
#include "FrameView.h"
#include "DocumentLoader.h"
#include "HitTestResult.h"
#if ENABLE(ICONDATABASE)
#include "IconDatabaseClientQt.h"
#endif
#if USE(JSC)
#include "JSDOMWindowBase.h"
#elif USE(V8)
......@@ -771,11 +774,25 @@ void FrameLoaderClientQt::didPerformFirstNavigation() const
m_webFrame->page()->d->updateNavigationActions();
}
void FrameLoaderClientQt::registerForIconNotification(bool)
void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister)
{
notImplemented();
#if ENABLE(ICONDATABASE)
if (shouldRegister)
connect(IconDatabaseClientQt::instance(), SIGNAL(iconLoadedForPageURL(QString)), this, SLOT(onIconLoadedForPageURL(QString)), Qt::UniqueConnection);
else
disconnect(IconDatabaseClientQt::instance(), SIGNAL(iconLoadedForPageURL(QString)), this, SLOT(onIconLoadedForPageURL(QString)));
#endif
}
void FrameLoaderClientQt::onIconLoadedForPageURL(const QString& url)
{
#if ENABLE(ICONDATABASE)
if (m_webFrame && m_webFrame->url() == url)
emit m_webFrame->iconChanged();
#endif
}
void FrameLoaderClientQt::updateGlobalHistory()
{
QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface();
......
......@@ -255,6 +255,9 @@ public:
static bool dumpHistoryCallbacks;
static QMap<QString, QString> URLsToRedirect;
private slots:
void onIconLoadedForPageURL(const QString&);
private:
Frame *m_frame;
QWebFrame *m_webFrame;
......
/*
* Copyright (C) 2011 Andreas Kling <kling@webkit.org>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "IconDatabaseClientQt.h"
#include "FrameLoaderClientQt.h"
#include "IconDatabaseBase.h"
#include <wtf/text/CString.h>
namespace WebCore {
IconDatabaseClientQt* IconDatabaseClientQt::instance()
{
static IconDatabaseClientQt* client = 0;
if (!client) {
client = new IconDatabaseClientQt;
iconDatabase().setClient(client);
}
return client;
}
IconDatabaseClientQt::IconDatabaseClientQt()
{
}
IconDatabaseClientQt::~IconDatabaseClientQt()
{
}
bool IconDatabaseClientQt::performImport()
{
return true;
}
void IconDatabaseClientQt::didRemoveAllIcons()
{
}
void IconDatabaseClientQt::didImportIconURLForPageURL(const String& url)
{
}
void IconDatabaseClientQt::didImportIconDataForPageURL(const String& url)
{
emit iconLoadedForPageURL(url);
}
void IconDatabaseClientQt::didChangeIconForPageURL(const String& url)
{
}
void IconDatabaseClientQt::didFinishURLImport()
{
}
}
#include "moc_IconDatabaseClientQt.cpp"
/*
* Copyright (C) 2011 Andreas Kling <kling@webkit.org>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IconDatabaseClientQt_h
#define IconDatabaseClientQt_h
#include "IconDatabaseClient.h"
#include <QtCore/QObject>
namespace WebCore {
class IconDatabaseClientQt : public QObject, public IconDatabaseClient {
Q_OBJECT
public:
static IconDatabaseClientQt* instance();
virtual bool performImport();
virtual void didRemoveAllIcons();
virtual void didImportIconURLForPageURL(const String&);
virtual void didImportIconDataForPageURL(const String&);
virtual void didChangeIconForPageURL(const String&);
virtual void didFinishURLImport();
signals:
void iconLoadedForPageURL(const QString&);
private:
IconDatabaseClientQt();
virtual ~IconDatabaseClientQt();
};
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment